protected function getTasks() { $tasks = []; $tasks['view-cron-log'] = []; $tasks['view-cron-log']['title'] = 'View Cron Log'; $tasks['view-cron-log']['description'] = 'View the cron log'; $tasks['view-cron-log']['run'] = [$this, 'actionCronLog']; $tasks['view-cron-log'] = []; $tasks['view-cron-log']['title'] = 'Manage Sensor Providers'; $tasks['view-cron-log']['description'] = 'Manage the sensor providers'; $tasks['view-cron-log']['url'] = ['/admin/provider/index']; $tasks['view-daemon-log'] = []; $tasks['view-daemon-log']['title'] = 'View Daemon Log'; $tasks['view-daemon-log']['description'] = 'View the daemon log'; $tasks['view-daemon-log']['run'] = [$this, 'actionDaemonLog']; $tasks['view-provider-log'] = []; $tasks['view-provider-log']['title'] = 'View Provider Log'; $tasks['view-provider-log']['description'] = 'View the provider log'; $tasks['view-provider-log']['run'] = [$this, 'actionProviderLog']; $tasks['flush-file-cache'] = []; $tasks['flush-file-cache']['title'] = 'Flush File Cache'; $tasks['flush-file-cache']['description'] = 'Clear the file cache in Cascade'; $tasks['flush-file-cache']['run'] = function () { Yii::$app->fileCache->flush(); Yii::$app->response->content = 'File cache was flushed!'; Yii::$app->response->taskOptions = ['state' => 'success', 'title' => 'Success']; }; $tasks['flush-cache'] = []; $tasks['flush-cache']['title'] = 'Flush Memory Cache'; $tasks['flush-cache']['description'] = 'Clear the memory cache in Cascade'; $tasks['flush-cache']['run'] = function () { Yii::$app->cache->flush(); Yii::$app->response->content = 'Memory cache was flushed!'; Yii::$app->response->taskOptions = ['state' => 'success', 'title' => 'Success']; }; $tasks['toggle-daemon'] = []; $tasks['toggle-daemon']['title'] = 'Toggle Daemon'; $tasks['toggle-daemon']['description'] = 'Pause/Resume the daemon'; $tasks['toggle-daemon']['run'] = function () { if (Daemon::isPaused()) { Daemon::resume(); Yii::$app->response->content = 'Daemons were resumed!'; } else { Daemon::pause(); Yii::$app->response->content = 'Daemons were paused!'; } Yii::$app->response->taskOptions = ['state' => 'success', 'title' => 'Success']; }; return $tasks; }