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