forked from entrepreneurj/FelixOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
79 lines (63 loc) · 2.06 KB
/
bootstrap.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
<?php
/*
* Sets up the Felix Online environment
*/
date_default_timezone_set('Europe/London');
// define current working directory
if(!defined('BASE_DIRECTORY')) define('BASE_DIRECTORY', dirname(__FILE__));
if(!defined('CACHE_DIRECTORY')) define('CACHE_DIRECTORY', BASE_DIRECTORY.'/cache/');
// Composer
require BASE_DIRECTORY.'/vendor/autoload.php';
/*
* Exceptions
*/
require_once(BASE_DIRECTORY.'/exceptions/FrontendException.php');
require_once(BASE_DIRECTORY.'/exceptions/NotFoundException.php');
require_once(BASE_DIRECTORY.'/exceptions/GlueURLException.php');
foreach (glob(BASE_DIRECTORY.'/exceptions/*.php') as $filename) {
require_once($filename);
}
require_once(BASE_DIRECTORY.'/core/glue.php');
$config = require_once(BASE_DIRECTORY.'/inc/config.inc.php');
require_once(BASE_DIRECTORY.'/vendor/felixonline/core/constants.php');
require_once(BASE_DIRECTORY.'/inc/const.inc.php');
/*
* Models
*/
foreach (glob(BASE_DIRECTORY.'/core/*.php') as $filename) {
require_once($filename);
}
// Initialize App
$app = new \FelixOnline\Core\App($config);
/* Initialise ezSQL database connection */
$db = new \ezSQL_mysqli();
$db->quick_connect(
$config['db_user'],
$config['db_pass'],
$config['db_name'],
$config['db_host'],
$config['db_port'],
'utf8'
);
$safesql = new \SafeSQL_MySQLi($db->dbh);
/* Set settings for caching (turned off by defualt) */
// Cache expiry
$db->cache_timeout = 24; // Note: this is hours
$db->use_disk_cache = true;
$db->cache_dir = 'inc/ezsql_cache'; // Specify a cache dir. Path is taken from calling script
$db->show_errors();
$app['db'] = $db;
$app['safesql'] = $safesql;
if (LOCAL) { // development connector
// Initialize Akismet
$connector = new \Riv\Service\Akismet\Connector\Test();
$app['akismet'] = new \Riv\Service\Akismet\Akismet($connector);
// Don't cache in local mode
$app['cache'] = new \Stash\Pool(new \Stash\Driver\BlackHole());
}
if (!PRODUCTION_FLAG) {
$app['cache'] = new \Stash\Pool(new \Stash\Driver\BlackHole());
}
// Initialize Sentry
$app['sentry'] = new \Raven_Client($app->getOption('sentry_dsn', NULL));
$app->run();