aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRedMatrix <info@friendica.com>2014-09-02 12:28:30 +1000
committerRedMatrix <info@friendica.com>2014-09-02 12:28:30 +1000
commit43738da24f6025fba2cdd9d2a7400f6f18cb1ca3 (patch)
tree62acad999528a9dfe6152d4924ba24ed5e804f85 /include
parentd507484cc52840e90fbe88568a56e61a183ef455 (diff)
parent6d7897a955319d7d83a558258936528d70501a89 (diff)
downloadvolse-hubzilla-43738da24f6025fba2cdd9d2a7400f6f18cb1ca3.tar.gz
volse-hubzilla-43738da24f6025fba2cdd9d2a7400f6f18cb1ca3.tar.bz2
volse-hubzilla-43738da24f6025fba2cdd9d2a7400f6f18cb1ca3.zip
Merge pull request #576 from beardy-unixer/master
Allow directories to stop being directories without killing anyone.
Diffstat (limited to 'include')
-rw-r--r--include/dir_fns.php20
-rw-r--r--include/poller.php3
2 files changed, 23 insertions, 0 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 815b6a197..5fad6567e 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -30,6 +30,26 @@ function find_upstream_directory($dirmode) {
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() {
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
diff --git a/include/poller.php b/include/poller.php
index 52ca98c97..2ba86dc0b 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -111,6 +111,9 @@ function poller_run($argv, $argc){
if(($d2 != $d1) && ($h1 == $h2)) {
+ require_once('include/dir_fns.php');
+ check_upstream_directory();
+
call_hooks('cron_daily',datetime_convert());