1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Add more fields

This commit is contained in:
Daniel 2021-10-15 09:51:34 -03:00
parent e997fc7bbc
commit c336e93ad9
2 changed files with 41 additions and 19 deletions

View file

@ -27,7 +27,7 @@ class Scheduler_commands extends ObjectYPT {
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='".self::$statusRepeat."' ";
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='" . self::$statusRepeat . "' ";
$minute = intval(date('i'));
$hour = intval(date('H'));
@ -61,7 +61,7 @@ class Scheduler_commands extends ObjectYPT {
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='".self::$statusActive."' AND date_to_execute <= now() ";
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='" . self::$statusActive . "' AND date_to_execute <= now() ";
//echo $sql;
$res = sqlDAL::readSql($sql);
@ -144,7 +144,7 @@ class Scheduler_commands extends ObjectYPT {
$this->setExecuted_in(date('Y-m-d H:i:s'));
$this->setCallbackResponse($callbackResponse);
if($this->status !== self::$statusRepeat){
if ($this->status !== self::$statusRepeat) {
$this->setStatus(self::$statusExecuted);
}
return $this->save();
@ -276,4 +276,26 @@ class Scheduler_commands extends ObjectYPT {
return $rows;
}
public static function getAllActiveOrToRepeat() {
global $global;
if (!static::isTableInstalled()) {
return false;
}
$sql = "SELECT * FROM " . static::getTableName() . " WHERE status='" . (self::$statusActive) . "' OR status='" . (self::$statusRepeat) . "' ";
$sql .= self::getSqlFromPost();
$res = sqlDAL::readSql($sql);
$fullData = sqlDAL::fetchAllAssoc($res);
sqlDAL::close($res);
$rows = array();
if ($res != false) {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}
}

View file

@ -11,7 +11,7 @@ if(!AVideoPlugin::isEnabledByName('Scheduler')){
return die('Scheduler is disabled');
}
$rowActive = Scheduler_commands::getAllActive();
$rowActive = Scheduler_commands::getAllActiveOrToRepeat();
$total = count($rowActive);
_log("There are {$total} active requests");