mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
Revert "Console 增加清理缓存功能"
This commit is contained in:
@@ -49,8 +49,7 @@ class Console
|
|||||||
"think\\console\\command\\Lists",
|
"think\\console\\command\\Lists",
|
||||||
"think\\console\\command\\Build",
|
"think\\console\\command\\Build",
|
||||||
"think\\console\\command\\make\\Controller",
|
"think\\console\\command\\make\\Controller",
|
||||||
"think\\console\\command\\make\\Model",
|
"think\\console\\command\\make\\Model"
|
||||||
"think\\console\\command\\cache\\Clear"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
|
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
|
||||||
|
|||||||
62
library/think/console/command/cache/Clear.php
vendored
62
library/think/console/command/cache/Clear.php
vendored
@@ -1,62 +0,0 @@
|
|||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2016 http://thinkphp.cn All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: 刘志淳 <chun@engineer.com>
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
namespace think\console\command\cache;
|
|
||||||
|
|
||||||
use think\console\command\Command;
|
|
||||||
use think\console\Input;
|
|
||||||
use think\console\input\Option as InputOption;
|
|
||||||
use think\console\Output;
|
|
||||||
|
|
||||||
class Clear extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
protected function configure()
|
|
||||||
{
|
|
||||||
$this->setName('cache:clear')
|
|
||||||
->setDescription('Clear Application Runtime');
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function execute(Input $input, Output $output)
|
|
||||||
{
|
|
||||||
if (APP_DEBUG) {
|
|
||||||
$output->writeln("Open debug, do not need clear.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$templateDir = RUNTIME_PATH . '\temp';
|
|
||||||
if (!file_exists($templateDir)) {
|
|
||||||
$output->writeln("Runtime does not exist.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->rmdirs($templateDir);
|
|
||||||
$output->writeln("Clear done!");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function rmdirs($dir)
|
|
||||||
{
|
|
||||||
$dir_arr = scandir($dir);
|
|
||||||
foreach($dir_arr as $key=>$val){
|
|
||||||
if($val == '.' || $val == '..'){}
|
|
||||||
else {
|
|
||||||
if(is_dir($dir.'/'.$val))
|
|
||||||
{
|
|
||||||
if(@rmdir($dir.'/'.$val) == 'true'){}
|
|
||||||
else
|
|
||||||
rmdirs($dir.'/'.$val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
unlink($dir.'/'.$val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user