/** * This command echoes what you have entered as the message. * @param string $message the message to be echoed. */ public function actionIndex() { Yii::info('CronController', 'cronjob'); /** * If cron execute it the default date and time are wrong, * this fix it (date_default_timezone_set) */ $settingModel = Setting::find()->where(['name' => 'date_default_timezone'])->one(); if (isset($settingModel->data) and !empty($settingModel->data)) { date_default_timezone_set($settingModel->data); } $modelCronjob = new Cronjob(); $modelCronjob->cron(); }
public function actionCron() { $model = new Cronjob(); $model->cron(); return $this->redirect(['index']); }