Add check_upstream_directory() to check that your directory is still
a directory, and if it isn't, let find_upstream_directory() find you a new one.
This commit is contained in:
parent
45c35d97b8
commit
473e582d1f
@ -30,6 +30,26 @@ function find_upstream_directory($dirmode) {
|
|||||||
return array('url' => $preferred);
|
return array('url' => $preferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_upstream_directory() {
|
||||||
|
/**
|
||||||
|
* Directories may come and go over time. We will need to check that our
|
||||||
|
* directory server is still valid occasionally, and reset to something that
|
||||||
|
* is if our directory has gone offline for any reason
|
||||||
|
*/
|
||||||
|
$directory = get_config('system','directory_server');
|
||||||
|
if ($directory) {
|
||||||
|
$r = q("select * from site where site_url = '%s' and (site_flags & %d) ",
|
||||||
|
dbesc($directory),
|
||||||
|
intval(DIRECTORY_MODE_PRIMARY|DIRECTORY_MODE_SECONDARY|DIRECTORY_MODE_STANDALONE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// If we've got something, it's still a directory. If we haven't, we need to reset and let find_upstream_directory() fix it
|
||||||
|
if (! $r) {
|
||||||
|
set_config('system','directory_server','');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
function dir_sort_links() {
|
function dir_sort_links() {
|
||||||
|
|
||||||
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
|
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
|
||||||
|
@ -111,6 +111,9 @@ function poller_run($argv, $argc){
|
|||||||
|
|
||||||
if(($d2 != $d1) && ($h1 == $h2)) {
|
if(($d2 != $d1) && ($h1 == $h2)) {
|
||||||
|
|
||||||
|
require_once('include/dir_fns.php');
|
||||||
|
check_upstream_directory();
|
||||||
|
|
||||||
call_hooks('cron_daily',datetime_convert());
|
call_hooks('cron_daily',datetime_convert());
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user