Skip to content

Commit

Permalink
修改BOOTSTRAP位置和方式,修复断言错误
Browse files Browse the repository at this point in the history
  • Loading branch information
NewFuture committed Aug 19, 2016
1 parent 315e9b7 commit ce170d8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
5 changes: 3 additions & 2 deletions conf/app.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[common];公用配置
version = 2.4.2
version = 2.4.3
application.directory = APP_PATH "/app/"
application.library = APP_PATH "/library"
application.num_param = 'id' ;id形默认绑定参数 如 /User/123 =>绑定参数$id值未123
Expand Down Expand Up @@ -53,7 +53,7 @@ cors.Access-Control-Max-Age = 3628800
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[dev:common];本地(开发调试)配置
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
application.bootstrap = APP_PATH "/app/Bootstrap.dev.php"
application.bootstrap = APP_PATH "/library/Bootstrap/dev.php"
application.system.cache_config = 0

;特殊配置path
Expand All @@ -79,6 +79,7 @@ log.mode = '0777';文件权限,仅对开发环境设置有效
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[product:common];线上(生产环境)配置
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;application.bootstrap = APP_PATH "/library/Bootstrap/product.php"
application.dispatcher.throwException = 1
application.dispatcher.catchException = 1
application.system.cache_config = 1
Expand Down
3 changes: 2 additions & 1 deletion app/Bootstrap.dev.php → library/Bootstrap/dev.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
use \Storage\File as File;
use \Logger as Logger;

/**
* 调试启动加载
Expand Down Expand Up @@ -43,7 +44,7 @@ public function _initAssert()
assert_options(ASSERT_ACTIVE, false);
}

assert_options(ASSERT_QUIET_EVAL, true);//在断言表达式求值时禁用error_reporting
assert_options(ASSERT_QUIET_EVAL, false);//关闭在断言表达式求值时禁用error_reporting
assert_options(ASSERT_WARNING, $assert['warning']);//为每个失败的断言产生一个 PHP 警告(warning)
assert_options(ASSERT_BAIL, $assert['bail']);//在断言失败时中止执行
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion library/Orm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ protected function buildCondition(&$condition, $pre='')
$value=&$w[3];
if (is_array($value)) {
if ('BETWEEN'===$operator||'NOT BETWEEN'===$operator) { //BETWEEN
assert('2===count($value))', '[Orm::buildCondition] between 操作后续 参数必须是两个值');
assert('2===count($value)', '[Orm::buildCondition] between 操作后续 参数必须是两个值');
$value= $value[0].' AND '.$value[1];
} else {
//IN
Expand Down
7 changes: 5 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
define('APP_PATH', dirname(dirname(__FILE__))); //项目目录
$app = new Yaf_Application(APP_PATH . '/conf/app.ini');
$app->bootstrap()->run();
?>

if ($app->getConfig()->application->bootstrap) {
$app->bootstrap();//加载启动项
}
$app->run();
5 changes: 4 additions & 1 deletion tests/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
define('TRACER_OFF', true);

$app=new Yaf_Application(APP_PATH . '/conf/app.ini');
$app->bootstrap();
if ($app->getConfig()->application->bootstrap) {
$app->bootstrap();//加载启动项
}

0 comments on commit ce170d8

Please sign in to comment.