public function __construct($title = null, $ToDBSave = true) { $this->StartTime = time(); $this->colors = new Colors(); $this->MessageDepth = 0; $this->ToDBSave = $ToDBSave; global $TestLog; if ($title == null) { $title == "Unknown Test"; } $this->title = $title; $this->TestLog = $TestLog; $this->log($this->colors->getColoredString($this->title, "yellow")); $this->Successes = array(); $this->Failures = array(); load_tasks(); if ($this->ToDBSave) { $this->log_task_output(run_task("CreateDBSaveState")); } }
https://github.com/evantahler/PHP-DAVE-API Evan Tahler | 2011 I am the task runner. Tasks can be run with the following syntax: php API/TASK.php --task=name_of_task, or by instantitaiting the class directly ***********************************************/ $parts = explode("/", __FILE__); $ThisFile = $parts[count($parts) - 1]; chdir(substr(__FILE__, 0, strlen(__FILE__) - strlen($ThisFile))); require_once "LoadEnv.php"; unset($parts); unset($ThisFile); require_once "helper_functions/parseArgs.php"; $ARGS = __parseArgs(); $TaskNames = load_tasks(); // help / List if ($ARGS["h"] == true || $ARGS["help"] == true || $ARGS["l"] == true || $ARGS["list"] == true) { echo "Task List:\r\n\r\n"; $max_name_length = 0; foreach ($TaskNames as $class_name) { if (strlen($class_name) > $max_name_length) { $max_name_length = strlen($class_name); } } foreach ($TaskNames as $class_name) { echo "- " . $class_name::class_name(); $i = strlen($class_name); while ($i < $max_name_length + 4) { echo " "; $i++;
/*********************************************** DAVE PHP API https://github.com/evantahler/PHP-DAVE-API Evan Tahler | 2011 Set this page to be fired off every minute by your cron process, and then put the logic inside this page. The output of this page will be added to the CRON_LOG.txt file ***********************************************/ // Cron example: */1 * * * * /usr/bin/php /path/to/CRON.php > /path/to/CRON_LOG.txt $parts = explode("/", __FILE__); $ThisFile = $parts[count($parts) - 1]; chdir(substr(__FILE__, 0, strlen(__FILE__) - strlen($ThisFile))); require_once "LoadEnv.php"; unset($parts); unset($ThisFile); load_tasks(); $CRON_OUTPUT = "STARTING CRON @ " . date("m-d-Y H:i:s") . "\r\n\r\n"; ///////////////////////////////////////////////////////////////////////// // Do Tasks $CRON_OUTPUT .= run_task("CleanCache"); $CRON_OUTPUT .= run_task("CleanLog"); $CRON_OUTPUT .= run_task("CleanSessions"); $CRON_OUTPUT .= run_task("RemoveLargeLogs"); ///////////////////////////////////////////////////////////////////////// // End the log output echo $CRON_OUTPUT; $fh = fopen($CONFIG['CronLogFile'], 'a'); fwrite($fh, $CRON_OUTPUT); fclose($fh); exit;