mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 06:55:19 +00:00
54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Code\Daemon;
|
|
|
|
use Code\Lib\Libzot;
|
|
use Code\Lib\Libzotdir;
|
|
use Code\Lib\Queue;
|
|
use Code\Lib\Channel;
|
|
|
|
class Directory
|
|
{
|
|
|
|
public static function run($argc, $argv)
|
|
{
|
|
|
|
if ($argc < 2) {
|
|
return;
|
|
}
|
|
|
|
$force = false;
|
|
$pushall = true;
|
|
|
|
if ($argc > 2) {
|
|
if ($argv[2] === 'force') {
|
|
$force = true;
|
|
}
|
|
if ($argv[2] === 'nopush') {
|
|
$pushall = false;
|
|
}
|
|
}
|
|
|
|
logger('directory update', LOGGER_DEBUG);
|
|
|
|
$channel = Channel::from_id($argv[1]);
|
|
if (! $channel) {
|
|
return;
|
|
}
|
|
|
|
// update the local directory - was optional, but now done regardless
|
|
|
|
Libzotdir::local_dir_update($argv[1], $force);
|
|
|
|
q(
|
|
"update channel set channel_dirdate = '%s' where channel_id = %d",
|
|
dbesc(datetime_convert()),
|
|
intval($channel['channel_id'])
|
|
);
|
|
|
|
// Now update all the connections
|
|
if ($pushall) {
|
|
Run::Summon([ 'Notifier','refresh_all',$channel['channel_id'] ]);
|
|
}
|
|
}
|
|
}
|