3 * @file src/Worker/Directory.php
4 * @brief Sends updated profile data to the directory
7 namespace Friendica\Worker;
9 use Friendica\Core\Addon;
10 use Friendica\Core\Config;
11 use Friendica\Core\Worker;
12 use Friendica\Database\DBA;
13 use Friendica\Util\Network;
17 public static function execute($url = '')
19 $dir = Config::get('system', 'directory');
32 $arr = ['url' => $url];
34 Addon::callHooks('globaldir_update', $arr);
36 logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
37 if (strlen($arr['url'])) {
38 Network::fetchUrl($dir . '?url=' . bin2hex($arr['url']));
44 private static function updateAll() {
45 $r = q("SELECT `url` FROM `contact`
46 INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid`
47 INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
48 WHERE `contact`.`self` AND `profile`.`net-publish` AND `profile`.`is-default` AND
49 NOT `user`.`account_expired` AND `user`.`verified`");
51 if (DBA::isResult($r)) {
52 foreach ($r AS $user) {
53 Worker::add(PRIORITY_LOW, 'Directory', $user['url']);