-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add botman:cache:clear command (#26)
1 parent
e4484a7
commit c34e49b
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace BotMan\Studio\Console\Commands; | ||
|
||
use Illuminate\Filesystem\Filesystem; | ||
use Illuminate\Console\GeneratorCommand; | ||
|
||
class BotManCacheClear extends GeneratorCommand | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'botman:cache:clear'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Remove all cached conversations.'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @param \Illuminate\Filesystem\Filesystem $files | ||
* @return mixed | ||
*/ | ||
public function handle(Filesystem $files) | ||
{ | ||
$cacheFolder = storage_path('botman'); | ||
|
||
if ($files->exists($cacheFolder)) { | ||
$files->cleanDirectory($cacheFolder); | ||
} | ||
|
||
$this->info('BotMan cache cleared!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters