增加 optimize:schema 命令 用于生成 数据表字段信息缓存

This commit is contained in:
thinkphp
2016-09-18 17:01:55 +08:00
parent 09598e67b3
commit 2b476fe7ff
5 changed files with 67 additions and 7 deletions

View File

@@ -44,6 +44,7 @@ class Console
"think\\console\\command\\optimize\\Autoload",
"think\\console\\command\\optimize\\Config",
"think\\console\\command\\optimize\\Route",
"think\\console\\command\\optimize\\Schema",
];
public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
@@ -130,7 +131,7 @@ class Console
$exitCode = $e->getCode();
if (is_numeric($exitCode)) {
$exitCode = (int)$exitCode;
$exitCode = (int) $exitCode;
if (0 === $exitCode) {
$exitCode = 1;
}
@@ -221,7 +222,7 @@ class Console
*/
public function setCatchExceptions($boolean)
{
$this->catchExceptions = (bool)$boolean;
$this->catchExceptions = (bool) $boolean;
}
/**
@@ -231,7 +232,7 @@ class Console
*/
public function setAutoExit($boolean)
{
$this->autoExit = (bool)$boolean;
$this->autoExit = (bool) $boolean;
}
/**
@@ -399,7 +400,7 @@ class Console
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
return preg_quote($matches[1]) . '[^:]*';
}, $namespace);
$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
$namespaces = preg_grep('{^' . $expr . '}', $allNamespaces);
if (empty($namespaces)) {
$message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
@@ -437,7 +438,7 @@ class Console
$expr = preg_replace_callback('{([^:]+|)}', function ($matches) {
return preg_quote($matches[1]) . '[^:]*';
}, $name);
$commands = preg_grep('{^' . $expr . '}', $allCommands);
$commands = preg_grep('{^' . $expr . '}', $allCommands);
if (empty($commands) || count(preg_grep('{^' . $expr . '$}', $commands)) < 1) {
if (false !== $pos = strrpos($name, ':')) {