forked from NetCommons3/NetCommons
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
67 lines (59 loc) · 2.16 KB
/
bootstrap.php
File metadata and controls
67 lines (59 loc) · 2.16 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
<?php
/**
* NetCommons bootstrap
*
* @author Jun Nishikawa <topaz2@m0n0m0n0.com>
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
*/
// phpDocumentor Settings
// Put author name to netcommons.php or netcommons.yaml
/* $author = 'Noriko Arai, Ryuji Masukawa'; */
$author = 'Your Name <yourname@domain.com>';
$header = <<<EOF
* @author Noriko Arai <arai@nii.ac.jp>
* @author $author
* @link http://www.netcommons.org NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @copyright Copyright 2014, NetCommons Project
EOF;
Configure::write('PhpDocumentor.classHeader', $header);
// 多数ファイルをインクルードしていて、xdebugの制限に引っかかるため
if (ini_get('xdebug.max_nesting_level')) {
ini_set('xdebug.max_nesting_level', 200);
}
// Load all plugins
$plugins = App::objects('plugins');
foreach ($plugins as $plugin) {
$options = array();
is_readable(ROOT . DS . 'app' . DS . 'Plugin' . DS . $plugin . DS . 'Config' . DS . 'bootstrap.php') &&
$options['bootstrap'] = true;
is_readable(ROOT . DS . 'app' . DS . 'Plugin' . DS . $plugin . DS . 'Config' . DS . 'routes.php') &&
$options['routes'] = true;
if (!CakePlugin::loaded($plugin)) {
CakePlugin::load($plugin, $options);
}
}
// 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);
}
}
App::uses('Router', 'Routing');
Router::parseExtensions();
if (Configure::read('NetCommons.installed')) {
return;
}
// Initialize application configurations
if (Configure::read('Security.salt') === 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi' ||
Configure::read('Security.cipherSeed') === '76859309657453542496749683645') {
App::uses('File', 'Utility');
App::uses('Security', 'Utility');
Configure::write('Security.salt', Security::generateAuthKey());
Configure::write('Security.cipherSeed', mt_rand() . mt_rand());
}