]> git.mxchange.org Git - friendica.git/blobdiff - include/directory.php
proc_run was replaced
[friendica.git] / include / directory.php
index 2ca367d369442dc1a31bed67ad81cc1f64659a7e..a2ccacf125d623894a374a83a2f69f494e31e279 100644 (file)
@@ -1,36 +1,19 @@
 <?php
-require_once("boot.php");
 
-use \Friendica\Core\Config;
+use Friendica\Core\Config;
+use Friendica\Core\Worker;
 
 function directory_run(&$argv, &$argc){
-       global $a, $db;
+       $dir = Config::get('system', 'directory');
 
-       if(is_null($a)) {
-               $a = new App;
-       }
-
-       if(is_null($db)) {
-               @include(".htconfig.php");
-               require_once("include/dba.php");
-               $db = new dba($db_host, $db_user, $db_pass, $db_data);
-                               unset($db_host, $db_user, $db_pass, $db_data);
-       };
-
-       Config::load();
-
-       if($argc != 2)
+       if (!strlen($dir)) {
                return;
+       }
 
-       load_hooks();
-
-
-       $a->set_baseurl(get_config('system','url'));
-
-       $dir = get_config('system','directory');
-
-       if(! strlen($dir))
+       if ($argc < 2) {
+               directory_update_all();
                return;
+       }
 
        $dir .= "/submit";
 
@@ -39,13 +22,23 @@ function directory_run(&$argv, &$argc){
        call_hooks('globaldir_update', $arr);
 
        logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
-       if(strlen($arr['url']))
+       if (strlen($arr['url'])) {
                fetch_url($dir . '?url=' . bin2hex($arr['url']));
+       }
 
        return;
 }
 
-if (array_search(__file__,get_included_files())===0){
-  directory_run($_SERVER["argv"],$_SERVER["argc"]);
-  killme();
+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) {
+                       Worker::add(PRIORITY_LOW, 'directory', $user['url']);
+               }
+       }
 }