2014-05-14 23:24:20 +10:00
|
|
|
<?php namespace System\Console;
|
|
|
|
|
|
|
|
use App;
|
|
|
|
use Config;
|
|
|
|
use Illuminate\Cache\Console\ClearCommand;
|
|
|
|
use Symfony\Component\Console\Output\NullOutput;
|
|
|
|
|
|
|
|
class CacheClear extends ClearCommand
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
|
|
|
public function fire()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Allow this command to be executed internally
|
|
|
|
*/
|
|
|
|
if (!isset($this->output)) {
|
|
|
|
$this->output = new NullOutput;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Combiner
|
|
|
|
*/
|
|
|
|
foreach ($this->files->directories(storage_path().'/combiner') as $directory) {
|
|
|
|
$this->files->deleteDirectory($directory);
|
|
|
|
}
|
|
|
|
$this->info('Combiner cache cleared!');
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Twig
|
|
|
|
*/
|
|
|
|
if (!Config::get('cms.twigNoCache')) {
|
|
|
|
foreach ($this->files->directories(storage_path().'/twig') as $directory) {
|
|
|
|
$this->files->deleteDirectory($directory);
|
|
|
|
}
|
|
|
|
$this->info('Twig cache cleared!');
|
|
|
|
}
|
|
|
|
|
2014-05-21 16:36:05 +10:00
|
|
|
/*
|
|
|
|
* Meta
|
|
|
|
*/
|
|
|
|
$this->files->delete($this->laravel['config']['app.manifest'].'/disabled.json');
|
|
|
|
|
2014-05-14 23:24:20 +10:00
|
|
|
parent::fire();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear the cache outside of shell environment
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public static function fireInternal()
|
|
|
|
{
|
2014-05-15 08:35:41 +10:00
|
|
|
try {
|
|
|
|
$command = App::make('System\Console\CacheClear');
|
2014-06-12 19:02:30 +10:00
|
|
|
$command->setLaravel(App::make('app'));
|
2014-05-15 08:35:41 +10:00
|
|
|
$command->fire();
|
2014-11-01 12:00:45 +11:00
|
|
|
}
|
|
|
|
catch (\Exception $ex) {
|
|
|
|
// Do nothing
|
2014-05-15 08:35:41 +10:00
|
|
|
}
|
2014-05-14 23:24:20 +10:00
|
|
|
}
|
2014-10-18 11:58:50 +02:00
|
|
|
}
|