#141 fixed cron, show time_ago_string instead of date in saidmod cron

This commit is contained in:
Ulf Gebhardt 2016-06-10 23:14:29 +02:00
parent 65155aa4fc
commit d8448df8bc
5 changed files with 7 additions and 7 deletions

View File

@ -23,8 +23,7 @@ class cron {
*/ */
public static function check($class){ public static function check($class){
if( !\class_exists($class) || if( !\class_exists($class) ||
!\is_array($parents = \class_parents($class)) || !((new $class) instanceof \SYSTEM\CRON\cronjob)){
!\array_search('SYSTEM\CRON\cronjob', $parents)){
return false;} return false;}
return true;} return true;}

View File

@ -14,7 +14,7 @@ namespace SYSTEM\CRON;
/** /**
* Conjob Class provided by System to delete System Cache. * Conjob Class provided by System to delete System Cache.
*/ */
class cron_cache_delete extends \SYSTEM\CRON\cronjob{ class cron_cache_delete implements \SYSTEM\CRON\cronjob{
/** /**
* Run the Cronjob and delete all Cache entries. * Run the Cronjob and delete all Cache entries.
* *

View File

@ -14,7 +14,7 @@ namespace SYSTEM\CRON;
/** /**
* Conjob Class provided by System to extract Logentries into sqlite files. * Conjob Class provided by System to extract Logentries into sqlite files.
*/ */
class cron_log2sqlite extends \SYSTEM\CRON\cronjob{ class cron_log2sqlite implements \SYSTEM\CRON\cronjob{
/** /**
* Run the Cronjob and extract Data from log, write it to sqlite files * Run the Cronjob and extract Data from log, write it to sqlite files
* *

View File

@ -14,11 +14,11 @@ namespace SYSTEM\CRON;
/** /**
* Conjob Class provided by System to derive from for custom Cronjobs. * Conjob Class provided by System to derive from for custom Cronjobs.
*/ */
abstract class cronjob{ interface cronjob{
/** /**
* Run the Cronjob and execute its task * Run the Cronjob and execute its task
* *
* @return int Return a Cronstatus for the Cron Class to update the db. * @return int Return a Cronstatus for the Cron Class to update the db.
*/ */
public abstract static function run(); public static function run();
} }

View File

@ -9,7 +9,8 @@ class saimod_sys_cron extends \SYSTEM\SAI\SaiModule {
$i = 0; $i = 0;
while($r = $res->next()){ while($r = $res->next()){
$r['selected_0'] = $r['selected_1'] = $r['selected_2'] = $r['selected_3'] = ''; $r['selected_0'] = $r['selected_1'] = $r['selected_2'] = $r['selected_3'] = '';
$r['next'] = date('Y-m-d H:i:s',\SYSTEM\CRON\cron::next($r['class'])); $r['next'] = \SYSTEM\time::time_ago_string(\SYSTEM\CRON\cron::next($r['class']));
$r['last_run'] = \SYSTEM\time::time_ago_string(\strtotime($r['last_run']));
$r['selected_'.$r['status']] = 'selected'; $r['selected_'.$r['status']] = 'selected';
$r['i'] = $i++; $r['i'] = $i++;
$vars['content'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_cron/tpl/list_entry.tpl'))->SERVERPATH(), $r);} $vars['content'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_cron/tpl/list_entry.tpl'))->SERVERPATH(), $r);}