/** * Caching Options */ public function actionCaching() { $form = new \humhub\modules\admin\models\forms\CacheSettingsForm(); if ($form->load(Yii::$app->request->post()) && $form->validate() && $form->save()) { Yii::$app->cache->flush(); Yii::$app->assetManager->clear(); Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved and flushed cache')); return $this->redirect(['/admin/setting/caching']); } $cacheTypes = array('yii\\caching\\DummyCache' => Yii::t('AdminModule.controllers_SettingController', 'No caching (Testing only!)'), 'yii\\caching\\FileCache' => Yii::t('AdminModule.controllers_SettingController', 'File'), 'yii\\caching\\ApcCache' => Yii::t('AdminModule.controllers_SettingController', 'APC')); return $this->render('caching', array('model' => $form, 'cacheTypes' => $cacheTypes)); }
/** * Caching Options */ public function actionCaching() { $form = new \humhub\modules\admin\models\forms\CacheSettingsForm(); $form->type = Setting::Get('type', 'cache'); $form->expireTime = Setting::Get('expireTime', 'cache'); if ($form->load(Yii::$app->request->post()) && $form->validate()) { Yii::$app->cache->flush(); Setting::Set('type', $form->type, 'cache'); Setting::Set('expireTime', $form->expireTime, 'cache'); // set flash message Yii::$app->getSession()->setFlash('data-saved', Yii::t('AdminModule.controllers_SettingController', 'Saved and flushed cache')); return Yii::$app->response->redirect(Url::toRoute('/admin/setting/caching')); } $cacheTypes = array('yii\\caching\\DummyCache' => Yii::t('AdminModule.controllers_SettingController', 'No caching (Testing only!)'), 'yii\\caching\\FileCache' => Yii::t('AdminModule.controllers_SettingController', 'File'), 'yii\\caching\\ApcCache' => Yii::t('AdminModule.controllers_SettingController', 'APC')); return $this->render('caching', array('model' => $form, 'cacheTypes' => $cacheTypes)); }