forked from kumamidori/BEARSaturday.Skeleton
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.php
51 lines (45 loc) · 1.48 KB
/
App.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* App root path
*/
define('_BEAR_APP_HOME', realpath(__DIR__));
// composer auto load
require_once __DIR__ . '/vendor/autoload.php';
$bearMode = isset($_SERVER['bearmode']) ? $_SERVER['bearmode'] : 0;
// profile
//include 'BEAR/Dev/Profile/script/startxh.php'; //xhprof
App::init($bearMode);
class App
{
/**
* @param int $bearMode
*/
public static function init($bearMode = 1)
{
$app = BEAR::loadConfig(__DIR__ . '/App/app.yml');
switch ($bearMode) {
case 1:
//debug mode (cache disabled)
$app['BEAR_Cache']['adapter'] = 0;
// no break
case 2:
//debug mode (cache enabled)
$app['core']['debug'] = true;
$app['App_Db']['dsn']['default'] = $app['App_Db']['dsn']['slave'] = $app['App_Db']['dsn']['test'];
$app['BEAR_Ro_Prototype']['__class'] = 'BEAR_Ro_Prototype_Debug';
break;
case 100:
// for UNIT test or HTTP access test
$app['core']['debug'] = false;
$app['App_Db']['dsn']['default'] = $app['App_Db']['dsn']['slave'] = $app['App_Db']['dsn']['test'];
$app['BEAR_Resource_Request']['__class'] = 'BEAR_Resource_Request_Test';
break;
case 0:
default:
// live
$app['core']['debug'] = false;
break;
}
BEAR::init($app);
}
}