Exemple #1
0
 protected function actionCheckDeleteCron($params)
 {
     if (!GO::modules()->isInstalled('cron')) {
         echo json\encode(array('success' => true, 'data' => array('enabled' => false, 'reason' => 'noCronModule')));
         return;
     }
     $cronJob = GO\Base\Cron\CronJob::model()->findSingleByAttribute('job', 'GO\\Files\\Cron\\DeleteExpiredLinks');
     if (!$cronJob) {
         echo json_encode(array('success' => true, 'data' => array('enabled' => false, 'reason' => 'noCronJob')));
         return;
     }
     echo json_encode(array('success' => true, 'data' => array('enabled' => $cronJob->active)));
 }
Exemple #2
0
 public function uninstall()
 {
     parent::uninstall();
     $cron = \GO\Base\Cron\CronJob::model()->findSingleByAttribute('job', 'GO\\Dropbox\\Cron\\Sync');
     if (!$cron) {
         // No cronjob found, so nothing needs to be deleted.
         return true;
     }
     if (!$cron->delete()) {
         // Try to delete the cronjob, if it's not possible then throw an exception.
         throw new \Exception('The Dropbox systemtask could not be deleted automatically. Please try to delete it manually in the "System tasks module."');
     } else {
         return true;
     }
 }
Exemple #3
0
 private function _findNextCron()
 {
     $currentTime = new \GO\Base\Util\Date\DateTime();
     $findParams = \GO\Base\Db\FindParams::newInstance()->single()->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('nextrun', $currentTime->getTimestamp(), '<')->addCondition('active', true));
     return \GO\Base\Cron\CronJob::model()->find($findParams);
 }
Exemple #4
0
 /**
  * Create the default notification cronjob for income contracts
  */
 public static function createDefaultIncomeContractNotificationCron()
 {
     $cron = new \GO\Base\Cron\CronJob();
     $cron->name = GO::t('incomeNotificationCron', 'projects2');
     $cron->active = true;
     $cron->runonce = false;
     $cron->minutes = '2';
     $cron->hours = '7';
     $cron->monthdays = '*';
     $cron->months = '*';
     $cron->weekdays = '*';
     $cron->job = 'GO\\Projects2\\Cron\\IncomeNotification';
     return $cron->save();
 }