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