2010-08-19 13:59:31 +02:00
|
|
|
<?php
|
2017-04-30 06:29:14 +02:00
|
|
|
|
|
|
|
use Friendica\Core\Config;
|
2017-11-05 13:15:53 +01:00
|
|
|
use Friendica\Core\Worker;
|
2017-11-08 04:57:46 +01:00
|
|
|
use Friendica\Database\DBM;
|
2017-01-18 22:45:32 +01:00
|
|
|
|
2012-11-05 09:28:54 +01:00
|
|
|
function directory_run(&$argv, &$argc){
|
2017-04-30 06:29:14 +02:00
|
|
|
$dir = Config::get('system', 'directory');
|
2010-08-19 13:59:31 +02:00
|
|
|
|
2017-02-27 00:16:49 +01:00
|
|
|
if (!strlen($dir)) {
|
2011-01-28 14:04:18 +01:00
|
|
|
return;
|
2017-02-27 00:16:49 +01:00
|
|
|
}
|
2010-08-19 13:59:31 +02:00
|
|
|
|
2017-04-17 23:39:11 +02:00
|
|
|
if ($argc < 2) {
|
|
|
|
directory_update_all();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2015-09-15 22:29:02 +02:00
|
|
|
$dir .= "/submit";
|
|
|
|
|
2012-05-22 01:40:11 +02:00
|
|
|
$arr = array('url' => $argv[1]);
|
|
|
|
|
|
|
|
call_hooks('globaldir_update', $arr);
|
|
|
|
|
2012-11-19 07:53:01 +01:00
|
|
|
logger('Updating directory: ' . $arr['url'], LOGGER_DEBUG);
|
2017-02-27 00:16:49 +01:00
|
|
|
if (strlen($arr['url'])) {
|
2012-05-22 01:40:11 +02:00
|
|
|
fetch_url($dir . '?url=' . bin2hex($arr['url']));
|
2017-02-27 00:16:49 +01:00
|
|
|
}
|
2017-04-04 19:47:32 +02:00
|
|
|
|
2011-01-24 22:01:56 +01:00
|
|
|
return;
|
2011-01-28 14:04:18 +01:00
|
|
|
}
|
2017-04-17 23:39:11 +02:00
|
|
|
|
|
|
|
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`");
|
|
|
|
|
2017-11-08 04:57:46 +01:00
|
|
|
if (DBM::is_result($r)) {
|
2017-04-17 23:39:11 +02:00
|
|
|
foreach ($r AS $user) {
|
2017-11-05 13:15:53 +01:00
|
|
|
Worker::add(PRIORITY_LOW, 'directory', $user['url']);
|
2017-04-17 23:39:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|