]> git.mxchange.org Git - friendica.git/blobdiff - include/directory.php
Remove unrecommended leading backslash for fully qualified namespaces
[friendica.git] / include / directory.php
index 057c156ad7abb99b46867deef5d1dfcdd3e7f990..e507a939f8cd36ef37e3ed7cceec44bd49253b99 100644 (file)
@@ -1,14 +1,16 @@
 <?php
-use \Friendica\Core\Config;
+
+use Friendica\Core\Config;
 
 function directory_run(&$argv, &$argc){
-       if ($argc != 2) {
+       $dir = Config::get('system', 'directory');
+
+       if (!strlen($dir)) {
                return;
        }
 
-       $dir = get_config('system','directory');
-
-       if (!strlen($dir)) {
+       if ($argc < 2) {
+               directory_update_all();
                return;
        }
 
@@ -22,5 +24,20 @@ function directory_run(&$argv, &$argc){
        if (strlen($arr['url'])) {
                fetch_url($dir . '?url=' . bin2hex($arr['url']));
        }
+
        return;
 }
+
+function directory_update_all() {
+       $r = q("SELECT `url` FROM `contact`
+               INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
+               INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
+                       WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
+                               NOT `user`.`account_expired` AND `user`.`verified`");
+
+       if (dbm::is_result($r)) {
+               foreach ($r AS $user) {
+                       proc_run(PRIORITY_LOW, 'include/directory.php', $user['url']);
+               }
+       }
+}