-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbootstrap.php
More file actions
77 lines (69 loc) · 2.28 KB
/
bootstrap.php
File metadata and controls
77 lines (69 loc) · 2.28 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* NetCommons bootstrap
*
* @author Jun Nishikawa <topaz2@m0n0m0n0.com>
* @author Shohei Nakajima <nakajimashouhei@gmail.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
// 多数ファイルをインクルードしていて、xdebugの制限に引っかかるため
if (ini_get('xdebug.max_nesting_level')) {
ini_set('xdebug.max_nesting_level', 200);
}
// Load application configurations
$conf = array();
$files = array('application.yml', 'application.local.yml');
foreach ($files as $file) {
if (file_exists(APP . 'Config' . DS . $file)) {
$conf = array_merge($conf, Spyc::YAMLLoad(APP . 'Config' . DS . $file));
Configure::write($conf);
}
}
if (! defined('NC3_VERSION')) {
App::uses('NetCommonsCache', 'NetCommons.Utility');
$ncCache = new NetCommonsCache('version', false, 'netcommons_core');
$version = $ncCache->read();
if ($version) {
define('NC3_VERSION', trim($version));
} elseif (file_exists(APP . 'VERSION')) {
define('NC3_VERSION', trim(file_get_contents(APP . 'VERSION')));
} else {
define('NC3_VERSION', '3.2.1');
}
}
// Load all plugins
$plugins = App::objects('plugins');
foreach ($plugins as $plugin) {
$options = array();
foreach (App::path('plugins') as $path) {
if (is_dir($path . $plugin)) {
$pluginPath = $path . $plugin;
is_readable($pluginPath . DS . 'Config' . DS . 'bootstrap.php') && $options['bootstrap'] = true;
is_readable($pluginPath . DS . 'Config' . DS . 'routes.php') && $options['routes'] = true;
if (!CakePlugin::loaded($plugin)) {
CakePlugin::load($plugin, $options);
}
}
}
}
if (! Configure::read('Config.language')) {
Configure::write('Config.language', 'ja');
}
App::uses('Router', 'Routing');
Router::parseExtensions();
//インストールのapplication.ymlがない場合、Noticeになるため
if (! Configure::read('NetCommons.installed')) {
if (CakePlugin::loaded('Install')) {
App::uses('InstallUtil', 'Install.Utility');
$InstallUtil = new InstallUtil();
}
} else {
App::uses('CakeSession', 'Model/Datasource');
CakeSession::start();
$debug = CakeSession::read('debug');
if (isset($debug) && is_numeric($debug) && $debug !== false) {
Configure::write('debug', $debug);
}
}