aboutsummaryrefslogtreecommitdiffstats
path: root/include/dir_fns.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-18 20:47:35 -0700
committerfriendica <info@friendica.com>2013-04-18 20:47:35 -0700
commit0fbb3b6a97e51fbfc02e56f3651d4bf9fdd0575c (patch)
treeef5ec7f30cc08270baeedb76b9476f2225f32783 /include/dir_fns.php
parent2679a5990e8551d8d63ef561d762ca16dde520c4 (diff)
downloadvolse-hubzilla-0fbb3b6a97e51fbfc02e56f3651d4bf9fdd0575c.tar.gz
volse-hubzilla-0fbb3b6a97e51fbfc02e56f3651d4bf9fdd0575c.tar.bz2
volse-hubzilla-0fbb3b6a97e51fbfc02e56f3651d4bf9fdd0575c.zip
for directory sync, ensure we have a fallback master; even if we have nothing else
Diffstat (limited to 'include/dir_fns.php')
-rw-r--r--include/dir_fns.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 677420c54..5a1d671cb 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -6,6 +6,49 @@ function find_upstream_directory($dirmode) {
return '';
}
+
+function sync_directories($dirmode) {
+
+ if($dirmode == DIRECTORY_MODE_STANDALONE || $dirmode == DIRECTORY_MODE_NORMAL)
+ return;
+
+ $r = q("select * from site where (site_flags & %d) and site_url != '%s'",
+ intval(DIRECTORY_MODE_PRIMARY),
+ dbesc(z_root())
+ );
+
+ // If there are no directory servers, setup the fallback master
+
+ if((! $r) && (z_root() != DIRECTORY_FALLBACK_MASTER)) {
+ $r = array(
+ 'site_url' => DIRECTORY_FALLBACK_MASTER,
+ 'site_flags' => DIRECTORY_MODE_PRIMARY,
+ 'site_update' => '0000-00-00 00:00:00',
+ 'site_directory' => DIRECTORY_FALLBACK_MASTER . '/dirsearch'
+ );
+ $x = q("insert into site ( site_url, site_flags, site_update, site_directory )
+ values ( '%s', %d', '%s', '%s' ) ",
+ dbesc($r[0]['site_url']),
+ intval($r[0]['site_flags']),
+ dbesc($r[0]['site_update']),
+ dbesc($r[0]['site_directory'])
+ );
+
+ }
+
+
+
+
+
+
+}
+
+
+
+
+
+
+
function syncdirs($uid) {
logger('syncdirs', LOGGER_DEBUG);