From 915824c883819362f6e4a284e65d46af26e4e979 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 7 Jun 2016 07:39:07 +0200 Subject: [PATCH] #3 system docu cache & cron + fixes --- api/api.php | 2 +- api/api_default.php | 2 +- api/api_login.php | 2 +- api/api_system.php | 2 +- api/verify.php | 2 +- cache/cache.php | 2 +- cache/cache_css.php | 2 +- cache/cache_filemask.php | 2 +- cache/cache_js.php | 2 +- cache/cache_scss.php | 2 +- cache/qq/SYS_CACHE_CHECK.php | 2 +- cache/qq/SYS_CACHE_DELETE.php | 2 +- cache/qq/SYS_CACHE_DELETE_ALL.php | 2 +- cache/qq/SYS_CACHE_PUT.php | 2 +- config/config.php | 41 +++++++++++-- config/config_ids.php | 37 +++++++++++- cron/cron.php | 51 +++++++++++++++- cron/cron_cache_delete.php | 19 ++++++ cron/cron_log2sqlite.php | 19 ++++++ cron/cronjob.php | 24 +++++++- cron/cronstatus.php | 36 +++++++++--- cron/crontime.php | 97 ++++++++++++++++++++++++++++--- cron/qq/SYS_CRON_GET.php | 14 +++++ cron/qq/SYS_CRON_LAST_VISIT.php | 14 +++++ cron/qq/SYS_CRON_LIST.php | 14 +++++ cron/qq/SYS_CRON_UPD.php | 14 +++++ 26 files changed, 364 insertions(+), 44 deletions(-) diff --git a/api/api.php b/api/api.php index dc49130..03b91dc 100644 --- a/api/api.php +++ b/api/api.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_api + * @package SYSTEM\API */ namespace SYSTEM\API; diff --git a/api/api_default.php b/api/api_default.php index cf363f1..43d28d7 100644 --- a/api/api_default.php +++ b/api/api_default.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_api + * @package SYSTEM\API */ namespace SYSTEM\API; diff --git a/api/api_login.php b/api/api_login.php index e683251..a37a2d5 100644 --- a/api/api_login.php +++ b/api/api_login.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_api + * @package SYSTEM\API */ namespace SYSTEM\API; diff --git a/api/api_system.php b/api/api_system.php index f16d3e7..f936429 100644 --- a/api/api_system.php +++ b/api/api_system.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_api + * @package SYSTEM\API */ namespace SYSTEM\API; diff --git a/api/verify.php b/api/verify.php index ed5aaf3..b1cb4e3 100644 --- a/api/verify.php +++ b/api/verify.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_api + * @package SYSTEM\API */ namespace SYSTEM\API; diff --git a/cache/cache.php b/cache/cache.php index 4eecbca..9ca0a2a 100644 --- a/cache/cache.php +++ b/cache/cache.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_cache + * @package SYSTEM\CACHE */ namespace SYSTEM\CACHE; diff --git a/cache/cache_css.php b/cache/cache_css.php index 1d98e4f..4d518fd 100644 --- a/cache/cache_css.php +++ b/cache/cache_css.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_cache + * @package SYSTEM\CACHE */ namespace SYSTEM\CACHE; diff --git a/cache/cache_filemask.php b/cache/cache_filemask.php index 2b402e9..232464a 100644 --- a/cache/cache_filemask.php +++ b/cache/cache_filemask.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_cache + * @package SYSTEM\CACHE */ namespace SYSTEM\CACHE; diff --git a/cache/cache_js.php b/cache/cache_js.php index d0405f2..eba7228 100644 --- a/cache/cache_js.php +++ b/cache/cache_js.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_cache + * @package SYSTEM\CACHE */ namespace SYSTEM\CACHE; diff --git a/cache/cache_scss.php b/cache/cache_scss.php index e779ef2..48fb8fd 100644 --- a/cache/cache_scss.php +++ b/cache/cache_scss.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_cache + * @package SYSTEM\CACHE */ namespace SYSTEM\CACHE; diff --git a/cache/qq/SYS_CACHE_CHECK.php b/cache/qq/SYS_CACHE_CHECK.php index a0cd5ac..583a09d 100644 --- a/cache/qq/SYS_CACHE_CHECK.php +++ b/cache/qq/SYS_CACHE_CHECK.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_sql + * @package SYSTEM\SQL */ namespace SYSTEM\SQL; diff --git a/cache/qq/SYS_CACHE_DELETE.php b/cache/qq/SYS_CACHE_DELETE.php index a11c7e9..8f523c4 100644 --- a/cache/qq/SYS_CACHE_DELETE.php +++ b/cache/qq/SYS_CACHE_DELETE.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_sql + * @package SYSTEM\SQL */ namespace SYSTEM\SQL; diff --git a/cache/qq/SYS_CACHE_DELETE_ALL.php b/cache/qq/SYS_CACHE_DELETE_ALL.php index 177625f..5786b64 100644 --- a/cache/qq/SYS_CACHE_DELETE_ALL.php +++ b/cache/qq/SYS_CACHE_DELETE_ALL.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_sql + * @package SYSTEM\SQL */ namespace SYSTEM\SQL; diff --git a/cache/qq/SYS_CACHE_PUT.php b/cache/qq/SYS_CACHE_PUT.php index d681e04..d9171c2 100644 --- a/cache/qq/SYS_CACHE_PUT.php +++ b/cache/qq/SYS_CACHE_PUT.php @@ -7,7 +7,7 @@ * @copyright 2016 Ulf Gebhardt (http://www.webcraft-media.de) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link https://github.com/webcraftmedia/system - * @package system_sql + * @package SYSTEM\SQL */ namespace SYSTEM\SQL; diff --git a/config/config.php b/config/config.php index abf456d..b624bf1 100644 --- a/config/config.php +++ b/config/config.php @@ -1,10 +1,29 @@ next()){ @@ -35,6 +59,12 @@ class cron { return \SYSTEM\LOG\JsonResult::ok(); } + /** + * Determine next run of a given Cronjob + * + * @param class $class Cronjob class + * @return time Returns the requested time + */ public static function next($class){ $cron = \SYSTEM\SQL\SYS_CRON_GET::Q1(array($class)); //check module @@ -49,6 +79,12 @@ class cron { $cron[\SYSTEM\SQL\system_cron::FIELD_MONTH]); } + /** + * Determine last run of a given Cronjob + * + * @param class $class Cronjob class + * @return time Returns the requested time + */ public static function last($class){ $cron = \SYSTEM\SQL\SYS_CRON_GET::Q1(array($class)); //check module @@ -63,10 +99,21 @@ class cron { $cron[\SYSTEM\SQL\system_cron::FIELD_MONTH]); } + /** + * Updates the Status of a Cronjob + * + * @param class $class Cronjob class + * @param int $status Status to be written + * @return bool Returns true or false + */ private static function status($class, $status){ - //new \SYSTEM\LOG\CRON('Cron Status for Class '.$class.' updated to: '. \SYSTEM\CRON\cronstatus::text($status)); return \SYSTEM\SQL\SYS_CRON_UPD::QI(array($status,time(),$class));} + /** + * Determines the time when the System-Cronjobs were executed the last time. + * + * @return time Returns the time last visited + */ public static function last_visit(){ return \SYSTEM\SQL\SYS_CRON_LAST_VISIT::Q1()['last_run'];} } \ No newline at end of file diff --git a/cron/cron_cache_delete.php b/cron/cron_cache_delete.php index e961f5e..ae3a79f 100644 --- a/cron/cron_cache_delete.php +++ b/cron/cron_cache_delete.php @@ -1,6 +1,25 @@