diff --git a/src/controllers/CacheController.php b/src/controllers/CacheController.php new file mode 100644 index 0000000..6e9224b --- /dev/null +++ b/src/controllers/CacheController.php @@ -0,0 +1,35 @@ +cache->flush()) { + \Yii::$app->session->addFlash('success', Yii::t('backend-module','Cache cleared')); + } else { + \Yii::$app->session->addFlash('error', Yii::t('backend-module','Cannot clear cache')); + } + return $this->redirect(['default/index']); + } +} \ No newline at end of file diff --git a/src/controllers/DefaultController.php b/src/controllers/DefaultController.php index 97102d9..5a94263 100644 --- a/src/controllers/DefaultController.php +++ b/src/controllers/DefaultController.php @@ -75,22 +75,4 @@ public function renderDashboardMenu($item = []) return $menuItems; } - /** - * flush cache - * - * if APCu is used as cache we cannot flush cache from cli command - * see: https://github.com/yiisoft/yii2/issues/8647 - * - * @return \yii\web\Response - */ - public function actionCacheFlush() - { - if (Yii::$app->cache->flush()) { - Yii::$app->session->addFlash('success', Yii::t('backend-module','Cache cleared')); - } else { - Yii::$app->session->addFlash('error', Yii::t('backend-module','Cannot clear cache')); - } - return $this->goBack(['index']); - } - } diff --git a/src/views/default/index.php b/src/views/default/index.php index 90b40ec..69ee379 100644 --- a/src/views/default/index.php +++ b/src/views/default/index.php @@ -164,7 +164,7 @@
- +