1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 01:39:24 +02:00
Oinktube/plugin/Scheduler/run.php
2022-07-08 12:30:57 -03:00

46 lines
No EOL
1.3 KiB
PHP

<?php
//streamer config
require_once dirname(__FILE__) . '/../../videos/configuration.php';
if (!isCommandLineInterface() && !User::isAdmin()) {
return die('Command Line only');
}
if(!AVideoPlugin::isEnabledByName('Scheduler')){
return die('Scheduler is disabled');
}
$rowActive = Scheduler_commands::getAllActiveOrToRepeat();
$total1 = count($rowActive);
$rows = Scheduler_commands::getAllActiveAndReady();
$total2 = count($rows);
foreach ($rows as $value) {
_log("getAllActiveAndReady run ". json_encode($value));
$id = Scheduler::run($value['id']);
if(empty($id)){
_log("error [{$value['id']}] callbackURL={$value['callbackURL']}");
}
}
$rows = Scheduler_commands::getAllScheduledTORepeat();
$total3 = count($rows);
_log("There are {$total1} active requests; getAllActiveAndReady={$total2} getAllScheduledTORepeat={$total3} on time ". json_encode(Scheduler_commands::getTimesNow()));
foreach ($rows as $value) {
_log("getAllScheduledTORepeat run ". json_encode($value));
$id = Scheduler::run($value['id']);
if(empty($id)){
_log("error [{$value['id']}] callbackURL={$value['callbackURL']}");
}
}
function _log($msg){
if(!isCommandLineInterface()){
echo date('Y-m-d H:i:s').' '.$msg.'<br>';
}
_error_log("Scheduler::run {$msg}");
}