* merge ztSessionHandler.

This commit is contained in:
wangyidong
2022-11-10 15:47:05 +08:00
parent e8f50c14c6
commit 6eae8345f7
4 changed files with 27 additions and 22 deletions
+2 -6
View File
@@ -186,7 +186,7 @@ class cron extends control
/* Skip cron that status is running and run time is less than max. */
if($cronInfo->status == 'running' and (time() - strtotime($cronInfo->lastTime)) < $this->config->cron->maxRunTime) continue;
/* Skip cron that last time is more than this cron time. */
if ('cli' === PHP_SAPI)
if('cli' === PHP_SAPI)
{
if($cronInfo->lastTime >= $cron['time']->format(DT_DATETIME1)) continue;
}
@@ -197,10 +197,7 @@ class cron extends control
if($now > $cron['time'])
{
if (!$this->cron->changeStatusRunning($id, $cronInfo->lastTime))
{
continue;
}
if(!$this->cron->changeStatusRunning($id, $cronInfo->lastTime)) continue;
$parsedCrons[$id]['time'] = $cron['cron']->getNextRunDate();
/* Execution command. */
@@ -259,5 +256,4 @@ class cron extends control
/* Revert cron status to stop. */
$this->cron->markCronStatus('stop', $configID);
}
}
+5 -10
View File
@@ -98,21 +98,16 @@ class cronModel extends model
* Change cron status to running
*
* @param int $cronID
* @param string $lastTime
* @access public
* @return bool|int
* @return bool
*/
public function changeStatusRunning($cronID, $lastTime)
public function changeStatusRunning($cronID)
{
$data = new stdclass();
$data->status = 'running';
$data->status = 'running';
$data->lastTime = date(DT_DATETIME1);
$rows = $this->dao->update(TABLE_CRON)->data($data)
->where('id')->eq($cronID)
->andWhere('status')->ne('running')
->andWhere('lastTime')->eq($lastTime)
->exec();
return dao::isError() ? false : $rows;
$this->dao->update(TABLE_CRON)->data($data)->where('id')->eq($cronID)->exec();
return !dao::isError();
}
/**