Skip to content

Commit b54bbda

Browse files
committed
调整基准目录
1 parent ef274d5 commit b54bbda

File tree

7 files changed

+21
-124
lines changed

7 files changed

+21
-124
lines changed

.htaccess

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Options +FollowSymLinks +SymLinksIfOwnerMatch
33
# framework router settings.
44
<IfModule mod_rewrite.c>
55
RewriteEngine On
6-
RewriteBase /MS/zentaopms/www/redmine/
6+
RewriteBase /MS/zentaopms/redmine/
77
RewriteCond %{REQUEST_FILENAME} !-d
88
RewriteCond %{REQUEST_FILENAME} !-f
99
RewriteRule ^ index.php [QSA,L]

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ Redmine中只有Issue的概念,而禅道中有需求(Story)、任务(Task)、Bug
2222
* team 表:增加 id 自增字段
2323
* 。。。
2424

25+
## 使用
2526

27+
API 地址:
28+
29+
/zentao_path_url/rest/
30+
31+
.htaccess 中的RewriteBase 相应改一下
2632

2733

2834

app/controllers/HomeController.php

-67
This file was deleted.

app/models/Model.php

-30
This file was deleted.

app/models/User.php

-11
This file was deleted.

inc/zentao/core/Application.php

+13-14
Original file line numberDiff line numberDiff line change
@@ -268,25 +268,24 @@ class Application {
268268
* @access protected
269269
* @return void
270270
*/
271-
protected function __construct($appName = 'demo', $appRoot = '') {
271+
protected function __construct($appRoot) {
272272
$this->setPathFix();
273+
$this->setAppRoot($appRoot);
273274
$this->setBasePath();
274275
$this->setFrameRoot();
275276
$this->setCoreLibRoot();
276277
/* Load the framework. */
277-
278-
include $this->frameRoot . 'control.class.php';
279-
include $this->frameRoot . 'model.class.php';
280-
include $this->frameRoot . 'helper.class.php';
281-
282-
$this->setAppRoot($appName, $appRoot);
283278
$this->setTmpRoot();
284279
$this->setCacheRoot();
285280
$this->setLogRoot();
286281
$this->setConfigRoot();
287282
$this->setModuleRoot();
288283
$this->setThemeRoot();
289284

285+
include $this->frameRoot . 'control.class.php';
286+
include $this->frameRoot . 'model.class.php';
287+
include $this->frameRoot . 'helper.class.php';
288+
290289
$this->setSuperVars();
291290

292291
$this->loadConfig('common');
@@ -324,9 +323,9 @@ protected function __construct($appName = 'demo', $appRoot = '') {
324323
* @access public
325324
* @return object the app object
326325
*/
327-
public static function createApp($appName = 'demo', $appRoot = '') {
326+
public static function createApp($appRoot = '') {
328327
$className = __CLASS__;
329-
return new $className($appName, $appRoot);
328+
return new $className($appRoot);
330329
}
331330

332331
private static $_app;
@@ -337,9 +336,9 @@ public static function createApp($appName = 'demo', $appRoot = '') {
337336
* @param type $appRoot
338337
* @return Application
339338
*/
340-
public static function app($appName = 'demo', $appRoot = '') {
339+
public static function app($appRoot) {
341340
if (!self::$_app instanceof Application) {
342-
self::$_app = new Application($appName, $appRoot);
341+
self::$_app = new Application($appRoot);
343342
}
344343

345344
return self::$_app;
@@ -364,7 +363,7 @@ protected function setPathFix() {
364363
* @return void
365364
*/
366365
protected function setBasePath() {
367-
$this->basePath = realpath(dirname(dirname(ZTNB_ROOT))) . $this->pathFix;
366+
$this->basePath = realpath($this->appRoot) . $this->pathFix;
368367
}
369368

370369
/**
@@ -395,8 +394,8 @@ protected function setCoreLibRoot() {
395394
* @access protected
396395
* @return void
397396
*/
398-
protected function setAppRoot() {
399-
$this->appRoot = realpath(dirname(dirname(ZTNB_ROOT))) . $this->pathFix;
397+
protected function setAppRoot($appRoot) {
398+
$this->appRoot = realpath($appRoot) . $this->pathFix;
400399

401400
if (!is_dir($this->appRoot))
402401
$this->triggerError("The app you call not found in {$this->appRoot}", __FILE__, __LINE__, $exit = true);

index.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
require __DIR__ . '/inc/zentao/nb/Autoloader.php';
1111
\zentao\nb\Autoloader::register();
1212

13-
$app = \zentao\core\Application::app(); //禅道的router
13+
$app = \zentao\core\Application::app(dirname(ZTNB_ROOT)); //禅道的router
1414

1515
$slim = new \Slim\Slim();
1616

0 commit comments

Comments
 (0)