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->Database->query("INSERT INTO tl_cron (name, value) VALUES ('lastrun', $time)");
			$return = false;
		}

		// Check the last execution time
		elseif ($objCron->value <= ($time - $this->getCronTimeout()))
		{
			$this->Database->query("UPDATE tl_cron SET value=$time WHERE name='lastrun'");
			$return = false;
		}

		$this->Database->unlockTables();

		return $return;
	}
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->Database->query("INSERT INTO tl_cron (name, value) VALUES ('lastrun', $time)");
			$return = false;
		}

		// Check the last execution time
		elseif ($objCron->value <= ($time - $this->getCronTimeout()))
		{
			$this->Database->query("UPDATE tl_cron SET value=$time WHERE name='lastrun'");
			$return = false;
		}

		$this->Database->unlockTables();

		return $return;
	}
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 -> Database -> query ( "INSERT INTO tl_cron (name, value) VALUES ('lastrun', $time)" ) ; $ return = false ; } // Check the last execution time elseif ( $ objCron -> value <= ( $ time - $ this -> getCronTimeout ( ) ) ) { $ this -> Database -> query ( "UPDATE tl_cron SET value=$time WHERE name='lastrun'" ) ; $ return = false ; } $ this -> Database -> unlockTables ( ) ; return $ return ; }
Check whether the last script execution was less than a minute ago

@return boolean
Check whether the last script execution was less than a minute ago