1
0
mirror of https://github.com/flarum/core.git synced 2025-08-01 06:00:24 +02:00

Move cache:clear command to other namespace and actually flush the cache, too

Refs #837.
This commit is contained in:
Franz Liedke
2016-04-03 22:22:29 +09:00
parent ee8f4f04de
commit 729103c519
2 changed files with 19 additions and 2 deletions

View File

@@ -1,48 +0,0 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Console\Command;
class CacheClearCommand extends AbstractCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this
->setName('cache:clear')
->setDescription('Remove all temporary and generated files');
}
/**
* {@inheritdoc}
*/
protected function fire()
{
$this->info('Clearing the cache...');
$this->removeFilesMatching('assets', '*.js');
$this->removeFilesMatching('assets', '*.css');
}
protected function removeFilesMatching($path, $pattern)
{
$this->info("Removing $pattern files in $path...");
$path = $this->getPath($path);
array_map('unlink', glob("$path/$pattern"));
}
protected function getPath($path)
{
return base_path($path);
}
}

View File

@@ -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;