]> git.mxchange.org Git - friendica.git/blobdiff - include/directory.php
Resubmit all profiles on directory change
[friendica.git] / include / directory.php
index 088adbe789fd1fcfea3132cda0285fb8ccc88ab9..4a221fac0c3565ca2b598403e8131c0f084d7a6b 100644 (file)
@@ -2,16 +2,17 @@
 use \Friendica\Core\Config;
 
 function directory_run(&$argv, &$argc){
-       if ($argc != 2) {
-               return;
-       }
-
        $dir = get_config('system', 'directory');
 
        if (!strlen($dir)) {
                return;
        }
 
+       if ($argc < 2) {
+               directory_update_all();
+               return;
+       }
+
        $dir .= "/submit";
 
        $arr = array('url' => $argv[1]);
@@ -24,3 +25,17 @@ function directory_run(&$argv, &$argc){
        }
        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']);
+               }
+       }
+}