All pastes #466897 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-05-02 05:10 UTC
rendered paste body
	/*	CronJobs of the bot	*/	function cron()	{		$time = time();		if ($this -> crontimer["2sec"] < $time)		{			$this -> crontimer["2sec"] += 2;			if (!empty($this -> cron["2sec"]))			{				$crons = array_keys($this -> cron["2sec"]);				for ($i = 0; $i < count($crons); $i++)				$this -> cron["2sec"][$crons[$i]] -> cron();			}		}		if ($this -> crontimer["1min"] < $time)		{			$this -> crontimer["1min"] += 60;			if (!empty($this -> cron["1min"]))			{				$crons = array_keys($this -> cron["1min"]);				for ($i = 0; $i < count($crons); $i++)				$this -> cron["1min"][$crons[$i]] -> cron();			}		}		if ($this -> crontimer["1hour"] < $time)		{			$this -> crontimer["1hour"] += (60 * 60);			if (!empty($this -> cron["1hour"]))			{				$crons = array_keys($this -> cron["1hour"]);				for ($i = 0; $i < count($crons); $i++)				$this -> cron["1hour"][$crons[$i]] -> cron();			}		}		if ($this -> crontimer["12hour"] < $time)		{			$this -> crontimer["12hour"] += (12 * 60 * 60);			if (!empty($this -> cron["12hour"]))			{				$crons = array_keys($this -> cron["12hour"]);				for ($i = 0; $i < count($crons); $i++)				$this -> cron["12hour"][$crons[$i]] -> cron();			}		}		if ($this -> crontimer["24hour"] < $time)		{			$this -> crontimer["24hour"] += (24 * 60 * 60);			if (!empty($this -> cron["24hour"]))			{				$crons = array_keys($this -> cron["24hour"]);				for ($i = 0; $i < count($crons); $i++)				$this -> cron["24hour"][$crons[$i]] -> cron();			}		}	}