friendica-github/include/directory.php

46 lines
970 B
PHP
Raw Normal View History

<?php
use Friendica\Core\Config;
2017-11-05 12:15:53 +00:00
use Friendica\Core\Worker;
2017-11-08 03:57:46 +00:00
use Friendica\Database\DBM;
function directory_run(&$argv, &$argc){
$dir = Config::get('system', 'directory');
2017-02-26 23:16:49 +00:00
if (!strlen($dir)) {
return;
2017-02-26 23:16:49 +00:00
}
if ($argc < 2) {
directory_update_all();
return;
}
$dir .= "/submit";
$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'])) {
fetch_url($dir . '?url=' . bin2hex($arr['url']));
2017-02-26 23:16:49 +00:00
}
return;
}
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 03:57:46 +00:00
if (DBM::is_result($r)) {
foreach ($r AS $user) {
2017-11-05 12:15:53 +00:00
Worker::add(PRIORITY_LOW, 'directory', $user['url']);
}
}
}