From 142e76b11ae8fa1493b48be86f57cc64b92faff9 Mon Sep 17 00:00:00 2001 From: Tim G Date: Sun, 27 Nov 2016 14:49:56 -0500 Subject: [PATCH] Updated cron.php to just run the hooks it needs, no need for the different crons. $ php -q /var/www/dev-1-2-x.ezrpgproject.net/cron.php act=hour Nov-27-16 @ 19:47:56Executed Hourly --- core/src/cron/DailyCron.php | 34 ---------------------------------- core/src/cron/HalfHourCron.php | 32 -------------------------------- core/src/cron/HourlyCron.php | 32 -------------------------------- cron.php | 14 ++++---------- 4 files changed, 4 insertions(+), 108 deletions(-) delete mode 100644 core/src/cron/DailyCron.php delete mode 100644 core/src/cron/HalfHourCron.php delete mode 100644 core/src/cron/HourlyCron.php diff --git a/core/src/cron/DailyCron.php b/core/src/cron/DailyCron.php deleted file mode 100644 index c462754..0000000 --- a/core/src/cron/DailyCron.php +++ /dev/null @@ -1,34 +0,0 @@ -container = $container; - } - - public function start() - { - try { - error_reporting(E_ALL); - ini_set('display_errors', 1); - $this->container['hooks']->run_hooks('cron_daily'); - } catch (\Exception $ex) { - $ex->getMessage(); - } - } -} \ No newline at end of file diff --git a/core/src/cron/HalfHourCron.php b/core/src/cron/HalfHourCron.php deleted file mode 100644 index 2a46068..0000000 --- a/core/src/cron/HalfHourCron.php +++ /dev/null @@ -1,32 +0,0 @@ -container = $container; - } - - public function start() - { - try { - $this->container['hooks']->run_hooks('cron_30min'); - } catch (\Exception $ex) { - $ex->getMessage(); - } - } -} \ No newline at end of file diff --git a/core/src/cron/HourlyCron.php b/core/src/cron/HourlyCron.php deleted file mode 100644 index 0fce84f..0000000 --- a/core/src/cron/HourlyCron.php +++ /dev/null @@ -1,32 +0,0 @@ -container = $container; - } - - public function start() - { - try { - $this->container['hooks']->run_hooks('cron_1hr'); - } catch (\Exception $ex) { - $ex->getMessage(); - } - } -} \ No newline at end of file diff --git a/cron.php b/cron.php index 3ed409a..7aa2b44 100644 --- a/cron.php +++ b/cron.php @@ -31,32 +31,26 @@ $container = new \Pimple\Container; $ezrpg = new Application($container); - $ezrpg->getConfig(CUR_DIR . '/config.php'); + $ezrpg->getConfigFromCache(CUR_DIR . '/config.php'); // Database $ezrpg->setDatabase(); // Database password no longer needed, unset variable unset($config_password); - // Settings - $ezrpg->getSettings(); - $container['hooks'] = $hooks = $ezrpg->getHooks(); parse_str($argv[1], $params); if (isset($params['act'])) { if ($params['act'] == "hour") { - $cron = new \ezrpg\core\HourlyCron($container); - $cron->start(); + $ezrpg->hooks->run_hooks('cron_1hr'); echo date("M-d-y @ H:i:s") . "Executed Hourly \n"; } elseif ($params['act'] == "halfhour") { - $cron = new \ezrpg\core\HalfHourCron($container); - $cron->start(); + $ezrpg->hooks->run_hooks('cron_30min'); echo date("M-d-y @ H:i:s") . "Executed HalfHour \n"; } elseif ($params['act'] == "daily") { - $cron = new \ezrpg\core\DailyCron($container); - $cron->start(); + $ezrpg->hooks->run_hooks('cron_daily'); echo date("M-d-y @ H:i:s") . "Executed Daily"; } else { die('Unknown argument');