/**
  * Returns the configuration based on the primary key given.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the configuration to be loaded
  */
 public function loadCron($id)
 {
     $model = UserGroupsCron::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, Yii::t('userGroupsModule.admin', 'The requested cron does not exist.'));
     }
     return $model;
 }
Ejemplo n.º 2
0
 /**
  * initialize the list of cron jobs to perform
  */
 private function initializeCron()
 {
     $cron_model = new UserGroupsCron();
     $cron_model->name = 'garbage_collection';
     $cron_model->lapse = 7;
     $cron_model->save();
     $cron_model = new UserGroupsCron();
     $cron_model->name = 'unban';
     $cron_model->lapse = 1;
     $cron_model->save();
 }