From 729103c519d0066c2e31f79add5c37dd42add1b9 Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sun, 3 Apr 2016 22:22:29 +0900 Subject: [PATCH] Move cache:clear command to other namespace and actually flush the cache, too Refs #837. --- src/Console/Server.php | 2 +- .../Console}/CacheClearCommand.php | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) rename src/{Console/Command => Debug/Console}/CacheClearCommand.php (74%) diff --git a/src/Console/Server.php b/src/Console/Server.php index 9892a8122..38f1c94a3 100644 --- a/src/Console/Server.php +++ b/src/Console/Server.php @@ -11,9 +11,9 @@ namespace Flarum\Console; -use Flarum\Console\Command\CacheClearCommand; use Flarum\Console\Command\GenerateExtensionCommand; use Flarum\Console\Command\GenerateMigrationCommand; +use Flarum\Debug\Console\CacheClearCommand; use Flarum\Debug\Console\InfoCommand; use Flarum\Foundation\AbstractServer; use Flarum\Install\Console\InstallCommand; diff --git a/src/Console/Command/CacheClearCommand.php b/src/Debug/Console/CacheClearCommand.php similarity index 74% rename from src/Console/Command/CacheClearCommand.php rename to src/Debug/Console/CacheClearCommand.php index 7ce3feb71..aebff46e0 100644 --- a/src/Console/Command/CacheClearCommand.php +++ b/src/Debug/Console/CacheClearCommand.php @@ -8,10 +8,25 @@ * file that was distributed with this source code. */ -namespace Flarum\Console\Command; +namespace Flarum\Debug\Console; + +use Flarum\Console\Command\AbstractCommand; +use Illuminate\Contracts\Cache\Store; class CacheClearCommand extends AbstractCommand { + /** + * @var \Illuminate\Contracts\Cache\Store + */ + protected $cache; + + public function __construct(Store $cache) + { + $this->cache = $cache; + + parent::__construct(); + } + /** * {@inheritdoc} */ @@ -31,6 +46,8 @@ class CacheClearCommand extends AbstractCommand $this->removeFilesMatching('assets', '*.js'); $this->removeFilesMatching('assets', '*.css'); + + $this->cache->flush(); } protected function removeFilesMatching($path, $pattern)