Florian Schaal
2016-03-22 5ca959fa688255a8de61f89fe2751eb4d24a6912
server/lib/classes/cronjob.inc.php
@@ -47,7 +47,30 @@
   public function getSchedule() {
      return $this->_schedule;
      global $app, $conf;
      $class = get_class($this);
      switch ($class) {
         case 'cronjob_backup':
            $app->uses('ini_parser,getconf');
            $server_id = $conf['server_id'];
            $server_conf = $app->getconf->get_server_config($server_id, 'server');
            if(isset($server_conf['backup_time']) && $server_conf['backup_time'] != ''){
               list($hour, $minute) = explode(':', $server_conf['backup_time']);
               $schedule = $minute.' '.$hour.' * * *';
            } else {
               $schedule = '0 0 * * *';
            }
            break;
         /*case 'cronjob_backup_mail':
            $schedule = '1 0 * * *';
            break;*/
         default:
            $schedule = $this->_schedule;
      }
      return $schedule;
   }
@@ -56,7 +79,7 @@
   public function run() {
      print "Called run() for class " . get_class($this) . "\n";
      print "Job has schedule: " . $this->_schedule . "\n";
      print "Job has schedule: " . $this->getSchedule() . "\n";
      $this->onPrepare();
      $run_it = $this->onBeforeRun();
      if($run_it == true) {
@@ -86,7 +109,7 @@
         if($this->_run_at_new == true) {
            $this->_next_run = ISPConfigDateTime::dbtime(); // run now.
         } else {
            $app->cron->parseCronLine($this->_schedule);
            $app->cron->parseCronLine($this->getSchedule());
            $next_run = $app->cron->getNextRun(ISPConfigDateTime::dbtime());
            $this->_next_run = $next_run;
@@ -116,7 +139,7 @@
      // next_run time reached (reached === 0 or -1)
      // calculare next run time based on last_run or current time
      $app->cron->parseCronLine($this->_schedule);
      $app->cron->parseCronLine($this->getSchedule());
      if($this->_no_skip == true) {
         // we need to calculare the next run based on the previous next_run, as we may not skip one.
         $next_run = $app->cron->getNextRun($this->_next_run);