Contao\FrontendCron::hasToWait PHP Метод

hasToWait() защищенный Метод

Check whether the last script execution was less than a minute ago
protected hasToWait ( ) : boolean
Результат boolean
    protected function hasToWait()
    {
        $return = true;
        // Get the timestamp without seconds (see #5775)
        $time = strtotime(date('Y-m-d H:i'));
        // Lock the table
        $this->Database->lockTables(array('tl_cron' => 'WRITE'));
        // Get the last execution date
        $objCron = $this->Database->prepare("SELECT * FROM tl_cron WHERE name='lastrun'")->limit(1)->execute();
        // Add the cron entry
        if ($objCron->numRows < 1) {
            $this->updateCronTxt($time);
            $this->Database->query("INSERT INTO tl_cron (name, value) VALUES ('lastrun', {$time})");
            $return = false;
        } elseif ($objCron->value <= $time - $this->getCronTimeout()) {
            $this->updateCronTxt($time);
            $this->Database->query("UPDATE tl_cron SET value={$time} WHERE name='lastrun'");
            $return = false;
        }
        $this->Database->unlockTables();
        return $return;
    }