2016-05-20 02:42:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zotlabs\Daemon;
|
|
|
|
|
2018-06-01 02:42:13 +00:00
|
|
|
|
2021-12-02 22:33:36 +00:00
|
|
|
use Zotlabs\Lib\Libzot;
|
2018-06-05 06:19:16 +00:00
|
|
|
use Zotlabs\Lib\Libzotdir;
|
2018-07-03 05:43:41 +00:00
|
|
|
use Zotlabs\Lib\Queue;
|
2018-06-01 02:42:13 +00:00
|
|
|
|
2016-05-20 02:42:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Directory {
|
|
|
|
|
2018-07-18 00:26:26 +00:00
|
|
|
static public function run($argc,$argv) {
|
2016-05-20 02:42:45 +00:00
|
|
|
|
2020-09-02 05:55:13 +00:00
|
|
|
if ($argc < 2) {
|
2016-05-20 02:42:45 +00:00
|
|
|
return;
|
2020-09-02 05:55:13 +00:00
|
|
|
}
|
2016-05-20 02:42:45 +00:00
|
|
|
|
|
|
|
$force = false;
|
|
|
|
$pushall = true;
|
2020-08-16 02:18:11 +00:00
|
|
|
|
2020-09-02 05:55:13 +00:00
|
|
|
if ($argc > 2) {
|
|
|
|
if ($argv[2] === 'force') {
|
2016-05-20 02:42:45 +00:00
|
|
|
$force = true;
|
2020-09-02 05:55:13 +00:00
|
|
|
}
|
|
|
|
if ($argv[2] === 'nopush') {
|
2016-05-20 02:42:45 +00:00
|
|
|
$pushall = false;
|
2020-09-02 05:55:13 +00:00
|
|
|
}
|
2016-05-20 02:42:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
logger('directory update', LOGGER_DEBUG);
|
|
|
|
|
2018-07-18 00:26:26 +00:00
|
|
|
$channel = channelx_by_n($argv[1]);
|
2020-09-02 05:55:13 +00:00
|
|
|
if (! $channel) {
|
2018-07-18 00:26:26 +00:00
|
|
|
return;
|
2020-09-02 05:55:13 +00:00
|
|
|
}
|
2016-05-20 02:42:45 +00:00
|
|
|
|
2020-08-16 02:18:11 +00:00
|
|
|
// update the local directory - was optional, but now done regardless
|
|
|
|
|
|
|
|
Libzotdir::local_dir_update($argv[1],$force);
|
2016-05-20 02:42:45 +00:00
|
|
|
|
2020-08-16 02:18:11 +00:00
|
|
|
q("update channel set channel_dirdate = '%s' where channel_id = %d",
|
|
|
|
dbesc(datetime_convert()),
|
|
|
|
intval($channel['channel_id'])
|
|
|
|
);
|
2016-05-20 02:42:45 +00:00
|
|
|
|
2020-08-16 02:18:11 +00:00
|
|
|
// Now update all the connections
|
2020-09-02 05:55:13 +00:00
|
|
|
if ($pushall) {
|
2021-04-13 03:49:58 +00:00
|
|
|
Run::Summon( [ 'Notifier','refresh_all',$channel['channel_id'] ] );
|
2016-05-20 02:42:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|