Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Illuminate/Cache/Console/ClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Cache\CacheManager;
use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
Expand All @@ -12,6 +13,7 @@
#[AsCommand(name: 'cache:clear')]
class ClearCommand extends Command
{
use ConfirmableTrait;
/**
* The console command name.
*
Expand Down Expand Up @@ -57,10 +59,14 @@ public function __construct(CacheManager $cache, Filesystem $files)
/**
* Execute the console command.
*
* @return void
* @return int
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return Command::FAILURE;
}

$this->laravel['events']->dispatch(
'cache:clearing', [$this->argument('store'), $this->tags()]
);
Expand All @@ -70,14 +76,18 @@ public function handle()
$this->flushFacades();

if (! $successful) {
return $this->components->error('Failed to clear cache. Make sure you have the appropriate permissions.');
$this->components->error('Failed to clear cache. Make sure you have the appropriate permissions.');

return Command::FAILURE;
}

$this->laravel['events']->dispatch(
'cache:cleared', [$this->argument('store'), $this->tags()]
);

$this->components->info('Application cache cleared successfully.');

return Command::SUCCESS;
}

/**
Expand Down Expand Up @@ -141,6 +151,7 @@ protected function getOptions()
{
return [
['tags', null, InputOption::VALUE_OPTIONAL, 'The cache tags you would like to clear', null],
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
];
}
}
12 changes: 10 additions & 2 deletions src/Illuminate/Foundation/Console/ConfigCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Foundation\Console;

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Contracts\Console\Kernel as ConsoleKernelContract;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
Expand All @@ -13,12 +14,15 @@
#[AsCommand(name: 'config:cache')]
class ConfigCacheCommand extends Command
{
use ConfirmableTrait;

/**
* The console command name.
* The name and signature of the console command.
*
* @var string
*/
protected $name = 'config:cache';
protected $signature = 'config:cache
{--force : Force the operation to run when in production}';

/**
* The console command description.
Expand Down Expand Up @@ -55,6 +59,10 @@ public function __construct(Filesystem $files)
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return;
}

$this->callSilent('config:clear');

$config = $this->getFreshConfiguration();
Expand Down
23 changes: 22 additions & 1 deletion src/Illuminate/Foundation/Console/ConfigClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
namespace Illuminate\Foundation\Console;

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Filesystem\Filesystem;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand(name: 'config:clear')]
class ConfigClearCommand extends Command
{
use ConfirmableTrait;
/**
* The console command name.
*
Expand Down Expand Up @@ -45,12 +48,30 @@ public function __construct(Filesystem $files)
/**
* Execute the console command.
*
* @return void
* @return int
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return Command::FAILURE;
}

$this->files->delete($this->laravel->getCachedConfigPath());

$this->components->info('Configuration cache cleared successfully.');

return Command::SUCCESS;
}

/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
];
}
}
Loading
Loading