-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
新增「Artisan 命令-laravel:optimize-laravel:clean」功能
- Loading branch information
luisedware
committed
Aug 25, 2016
1 parent
bf55f6d
commit 6bcb672
Showing
10 changed files
with
436 additions
and
15 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
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,70 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class LaravelClean extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'laravel:clean'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'clean project all cache'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->line("即将执行清除缓存命令"); | ||
if($this->confirm('确定执行?')){ | ||
$this->line("开始执行缓存命令"); | ||
|
||
Artisan::call("clear-compiled"); | ||
|
||
Artisan::call("auth:clear-resets"); | ||
$this->info('Expired reset tokens cleared!'); | ||
|
||
Artisan::call("cache:clear"); | ||
$this->info('Application cache cleared!'); | ||
|
||
Artisan::call("config:clear"); | ||
$this->info('Configuration cache cleared!'); | ||
|
||
Artisan::call("debugbar:clear"); | ||
$this->info('Debugbar Storage cleared!'); | ||
|
||
Artisan::call("route:clear"); | ||
$this->info('Route cache cleared!'); | ||
|
||
Artisan::call("view:clear"); | ||
$this->info('Compiled views cleared!'); | ||
|
||
$this->info("清除缓存成功"); | ||
} else { | ||
$this->info("取消执行清除缓存命令"); | ||
} | ||
} | ||
} |
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,68 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
|
||
class LaravelOptimize extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'laravel:optimize'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'optimize laravel project'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->line("即将执行优化缓存命令"); | ||
if($this->confirm('确定执行?')){ | ||
$this->line("开始执行缓存命令"); | ||
|
||
Artisan::call("config:cache"); | ||
$this->info('Configuration cache cleared!'); | ||
$this->info('Configuration cached successfully!'); | ||
|
||
Artisan::call("route:cache"); | ||
$this->info('Route cache cleared!'); | ||
$this->info('Routes cached successfully!'); | ||
|
||
Artisan::call("optimize"); | ||
$this->info('Generating optimized class loader'); | ||
|
||
if(function_exists('exec')){ | ||
exec("composer dump-autoload"); | ||
} | ||
|
||
Artisan::call("ide-helper:generate"); | ||
$this->info('A new helper file was written to _ide_helper.php'); | ||
|
||
$this->info("优化缓存成功"); | ||
} else { | ||
$this->info("取消执行优化缓存命令"); | ||
} | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
|
||
namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
|
||
class SendEmails extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'emails:send'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'use SendCloud to send emails'; | ||
|
||
/** | ||
* Create a new command instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
// | ||
} | ||
} |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.