-
Notifications
You must be signed in to change notification settings - Fork 16
/
bootstrap.core.php
194 lines (178 loc) · 7.17 KB
/
bootstrap.core.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?php
/*
|--------------------------------------------------------------------------
| PIMF core bootstrap used for unit testing
|--------------------------------------------------------------------------
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
if (!defined('BASE_PATH')) {
define('BASE_PATH', realpath(__DIR__) . DS);
}
require_once 'autoload.core.php';
require_once 'utils.php';
\Pimf\Config::load(
array(
/*
|------------------------------------------------------------------------
| The default environment mode for your application [testing|production]
|------------------------------------------------------------------------
*/
'environment' => 'testing',
/*
|------------------------------------------------------------------------
| The default timezone of your application.
| Supported timezones list: http://www.php.net/manual/en/timezones.php
|------------------------------------------------------------------------
*/
'timezone' => 'UTC',
/*
|--------------------------------------------------------------------------
| Is it regular HTTP or secure HTTPS
|--------------------------------------------------------------------------
*/
'ssl' => false,
/*
|------------------------------------------------------------------------
| Application meta
|------------------------------------------------------------------------
*/
'app' => array(
'name' => 'MyFirstBlog',
// secret application key or try out http://randomkeygen.com
'key' => 'some5secret5key5here',
// the name of the fallback controller
'default_controller' => 'blog',
// get cleaner URLs or not
'routeable' => true,
// do you have a representational state transfer app?
'restfull' => false,
// URL used to access your application without a trailing slash.
'url' => 'http://localhost',
// if using mod_rewrite to get cleaner URLs let it empty otherwise set index.php
'index' => '',
// the base URL used for your application's asset files
'asset_url' => '',
),
/*
|------------------------------------------------------------------------
| Production environment settings
|------------------------------------------------------------------------
*/
'production' => array(
'db' => array(
'driver' => 'sqlite',
'database' => 'app/MyFirstBlog/_database/blog-production.db'
),
),
/*
|------------------------------------------------------------------------
| Production environment settings
|------------------------------------------------------------------------
*/
'testing' => array(
'db' => array(
'driver' => 'sqlite',
'database' => 'app/MyFirstBlog/_database/blog-production.db'
),
),
/*
|------------------------------------------------------------------------
| Bootstrapping meta
|------------------------------------------------------------------------
*/
'bootstrap' => array(
'local_temp_directory' => '/tmp/'
),
/*
|------------------------------------------------------------------------
| Settings for the error handling behavior
|------------------------------------------------------------------------
*/
'error' => array(
'ignore_levels' => array(0),
'debug_info' => true,
'log' => true,
),
/*
|------------------------------------------------------------------------
| Settings for the logging behavior
|------------------------------------------------------------------------
*/
'logging' => array(
//Logging storage 'file' or 'stdout'
'storage' => 'file',
),
/*
|--------------------------------------------------------------------------
| Session settings
|--------------------------------------------------------------------------
*/
'session' => array(
// Session storage 'cookie', 'file', 'pdo', 'memcached', 'apc', 'redis',
// 'dba', 'wincache', 'memory' or '' for non
'storage' => 'memory',
// If using file storage - default is null
'storage_path' => 'app/MyFirstBlog/_session/',
// If using the PDO (database) session storage
'database' => array(
'driver' => 'sqlite',
'database' => 'app/MyFirstBlog/_session/blog-session.db',
),
// Garbage collection has a 2% chance of occurring for any given request to
// the application. Feel free to tune this to your requirements.
'garbage_collection' => array(2, 100),
// Session lifetime number of minutes
'lifetime' => 60,
// Session expiration on web browser close
'expire_on_close' => false,
// Session cookie name
'cookie' => 'pimf_session',
// Session cookie path
'path' => '/',
// Domain for which the session cookie is available.
'domain' => null,
// If the cookie should only be sent over HTTPS.
'secure' => false,
),
/*
|--------------------------------------------------------------------------
| Cache settings
|--------------------------------------------------------------------------
*/
'cache' => array(
// Cache storage 'pdo', 'file', 'memcached', 'apc', 'redis', 'dba',
// 'wincache', 'memory' or '' for non
'storage' => 'memory',
// If using file storage - default is null
'storage_path' => 'app/MyFirstBlog/_cache/',
// If using the PDO (database) cache storage
'database' => array(
'driver' => 'sqlite',
'database' => 'app/MyFirstBlog/_cache/blog-cache.db',
),
// If using Memcached and APC to prevent collisions with other applications on the server.
'key' => 'pimfmaster',
// Memcached servers - for more check out: http://memcached.org
'memcached' => array(
'servers' => array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
),
),
)
);
$env = new \Pimf\Environment($_SERVER);
$envData = $env->data();
\Pimf\Logger::setup(
$env->getIp(),
$envData->get('PHP_SELF', $envData->get('SCRIPT_NAME'))
);
\Pimf\Util\Header\ResponseStatus::setup(
$envData->get('SERVER_PROTOCOL', 'HTTP/1.0'));
\Pimf\Util\Header::setup(
$env->getUserAgent()
);
\Pimf\Url::setup($env->getUrl(), $env->isHttps());
\Pimf\Uri::setup($env->PATH_INFO, $env->REQUEST_URI);
\Pimf\Util\Uuid::setup($env->getIp(), $env->getHost());
unset($env, $envData);