add cli mode
This commit is contained in:
@@ -23,6 +23,10 @@ class Widget_Init extends Typecho_Widget
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
if (php_sapi_name() == 'cli') {
|
||||
define('__TYPECHO_CLI__', true);
|
||||
}
|
||||
|
||||
/** 对变量赋值 */
|
||||
$options = $this->widget('Widget_Options');
|
||||
|
||||
@@ -32,6 +36,12 @@ class Widget_Init extends Typecho_Widget
|
||||
Typecho_I18n::setLang($dir . '/' . $options->lang . '.mo');
|
||||
}
|
||||
|
||||
/** 进入命令行格式 */
|
||||
if (defined('__TYPECHO_CLI__')) {
|
||||
new CLI();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/** cookie初始化 */
|
||||
Typecho_Cookie::setPrefix($options->rootUrl);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user