From 41b84342a29170facb02b33e0a8081befbac03c8 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Tue, 16 Mar 2010 08:07:45 +0000 Subject: [PATCH] + add the cli of zentaopms. --- bin/ztcli | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ bin/ztcli.bat | 1 + bin/ztcli.sh | 1 + 3 files changed, 64 insertions(+) create mode 100755 bin/ztcli create mode 100644 bin/ztcli.bat create mode 100755 bin/ztcli.sh diff --git a/bin/ztcli b/bin/ztcli new file mode 100755 index 0000000000..79aa21c109 --- /dev/null +++ b/bin/ztcli @@ -0,0 +1,62 @@ +#!/usr/bin/env php +. + * + * @copyright Copyright: 2009-2010 Chunsheng Wang + * @author Chunsheng Wang + * @package ZenTaoPMS + * @version $Id$ + * @link http://www.zentao.cn + */ +define('IN_SHELL', true); + +/* 获取命令参数。 */ +if($argc != 2) +{ + die('Usage: ' . basename(__FILE__) . " \n"); +} + +/* 包含必须的类文件。*/ +chdir(dirname(__FILE__)); +include '../../../framework/router.class.php'; +include '../../../framework/control.class.php'; +include '../../../framework/model.class.php'; +include '../../../framework/helper.class.php'; + +/* 实例化路由对象,并加载配置,连接到数据库。*/ +$app = router::createApp('pms'); +$config = $app->loadConfig('common'); +$dbh = $app->connectDB(); + +/* 设置终端使用的语言,并加载共用的模块。*/ +$app->setClientLang('zh-cn'); +$common = $app->loadCommon(); + +/* 加载相应的lib文件,并设置超全局变量的引用。*/ +$app->loadClass('front', $static = true); +$app->loadClass('filter', $static = true); +$app->setSuperVars(); + +/* 设置PATH_INFO变量。*/ +putenv('PATH_INFO=' . trim($argv[1])); +$config->requestType = 'PATH_INFO'; +$config->pathType = 'clean'; +$config->requestFix = '-'; + +/* 解析请求,加载模块。*/ +$app->parseRequest(); +$app->loadModule(); diff --git a/bin/ztcli.bat b/bin/ztcli.bat new file mode 100644 index 0000000000..68635d88b4 --- /dev/null +++ b/bin/ztcli.bat @@ -0,0 +1 @@ +php ztcli %* diff --git a/bin/ztcli.sh b/bin/ztcli.sh new file mode 100755 index 0000000000..cdeb151459 --- /dev/null +++ b/bin/ztcli.sh @@ -0,0 +1 @@ +php ztcli $*