]> git.mxchange.org Git - friendica.git/blobdiff - include/directory.php
Merge pull request #3365 from Hypolite/issue/remove-wrong-profile-link-for-contacts
[friendica.git] / include / directory.php
index 057c156ad7abb99b46867deef5d1dfcdd3e7f990..4a221fac0c3565ca2b598403e8131c0f084d7a6b 100644 (file)
@@ -2,13 +2,14 @@
 use \Friendica\Core\Config;
 
 function directory_run(&$argv, &$argc){
-       if ($argc != 2) {
+       $dir = get_config('system', 'directory');
+
+       if (!strlen($dir)) {
                return;
        }
 
-       $dir = get_config('system','directory');
-
-       if (!strlen($dir)) {
+       if ($argc < 2) {
+               directory_update_all();
                return;
        }
 
@@ -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']);
+               }
+       }
+}