mirror of
https://github.com/flarum/framework.git
synced 2025-06-06 16:24:33 +08:00
Move cache:clear command to other namespace and actually flush the cache, too
Refs #837.
This commit is contained in:
@ -11,9 +11,9 @@
|
|||||||
|
|
||||||
namespace Flarum\Console;
|
namespace Flarum\Console;
|
||||||
|
|
||||||
use Flarum\Console\Command\CacheClearCommand;
|
|
||||||
use Flarum\Console\Command\GenerateExtensionCommand;
|
use Flarum\Console\Command\GenerateExtensionCommand;
|
||||||
use Flarum\Console\Command\GenerateMigrationCommand;
|
use Flarum\Console\Command\GenerateMigrationCommand;
|
||||||
|
use Flarum\Debug\Console\CacheClearCommand;
|
||||||
use Flarum\Debug\Console\InfoCommand;
|
use Flarum\Debug\Console\InfoCommand;
|
||||||
use Flarum\Foundation\AbstractServer;
|
use Flarum\Foundation\AbstractServer;
|
||||||
use Flarum\Install\Console\InstallCommand;
|
use Flarum\Install\Console\InstallCommand;
|
||||||
|
@ -8,10 +8,25 @@
|
|||||||
* file that was distributed with this source code.
|
* 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
|
class CacheClearCommand extends AbstractCommand
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var \Illuminate\Contracts\Cache\Store
|
||||||
|
*/
|
||||||
|
protected $cache;
|
||||||
|
|
||||||
|
public function __construct(Store $cache)
|
||||||
|
{
|
||||||
|
$this->cache = $cache;
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
@ -31,6 +46,8 @@ class CacheClearCommand extends AbstractCommand
|
|||||||
|
|
||||||
$this->removeFilesMatching('assets', '*.js');
|
$this->removeFilesMatching('assets', '*.js');
|
||||||
$this->removeFilesMatching('assets', '*.css');
|
$this->removeFilesMatching('assets', '*.css');
|
||||||
|
|
||||||
|
$this->cache->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function removeFilesMatching($path, $pattern)
|
protected function removeFilesMatching($path, $pattern)
|
Reference in New Issue
Block a user