aboutsummaryrefslogtreecommitdiffstats
path: root/include/dir_fns.php
diff options
context:
space:
mode:
authorPaolo T <tuscanhobbit@users.noreply.github.com>2014-09-02 13:15:59 +0200
committerPaolo T <tuscanhobbit@users.noreply.github.com>2014-09-02 13:15:59 +0200
commitfee5b6bd1599599da2f3b662f04b9651b23fb4e4 (patch)
treee4ab47f657ce1e6ae0aabf6be51bdf169e4b389d /include/dir_fns.php
parenta1f85cda3ec0e6fc1c661ee12b1e7d87b3f242c5 (diff)
parent9dac46ca25b11f80dded42db31e7e062fc7b5142 (diff)
downloadvolse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.tar.gz
volse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.tar.bz2
volse-hubzilla-fee5b6bd1599599da2f3b662f04b9651b23fb4e4.zip
Merge pull request #2 from friendica/master
Merge from main project
Diffstat (limited to 'include/dir_fns.php')
-rw-r--r--include/dir_fns.php20
1 files changed, 20 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(