-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved cache flush functionality into separate controller
- Loading branch information
Showing
3 changed files
with
36 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* @link http://www.diemeisterei.de/ | ||
* @copyright Copyright (c) 2020 diemeisterei GmbH, Stuttgart | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace dmstr\modules\backend\controllers; | ||
|
||
|
||
use yii\web\Controller; | ||
use Yii; | ||
|
||
class CacheController extends Controller | ||
{ | ||
/** | ||
* 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 actionFlush() | ||
{ | ||
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->redirect(['default/index']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters