|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Tries to continue on startup trouble |
|
5
|
|
|
* |
|
6
|
|
|
* PHP Version 5 |
|
7
|
|
|
* |
|
8
|
|
|
* @category Core |
|
9
|
|
|
* @package Errors |
|
10
|
|
|
* @author Hans-Joachim Piepereit <[email protected]> |
|
11
|
|
|
* @copyright 2013 cSphere Team |
|
12
|
|
|
* @license http://opensource.org/licenses/bsd-license Simplified BSD License |
|
13
|
|
|
* @link http://www.csphere.eu |
|
14
|
|
|
**/ |
|
15
|
|
|
|
|
16
|
|
|
namespace csphere\core\errors; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Tries to continue on startup trouble |
|
20
|
|
|
* |
|
21
|
|
|
* @category Core |
|
22
|
|
|
* @package Errors |
|
23
|
|
|
* @author Hans-Joachim Piepereit <[email protected]> |
|
24
|
|
|
* @copyright 2013 cSphere Team |
|
25
|
|
|
* @license http://opensource.org/licenses/bsd-license Simplified BSD License |
|
26
|
|
|
* @link http://www.csphere.eu |
|
27
|
|
|
**/ |
|
28
|
|
|
|
|
29
|
|
|
class Startup |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* Necessity begets ingenuity |
|
33
|
|
|
* |
|
34
|
|
|
* @param array $error Error as an array |
|
35
|
|
|
* |
|
36
|
|
|
* @return void |
|
37
|
|
|
**/ |
|
|
|
|
|
|
38
|
|
|
|
|
39
|
|
|
public static function rescue(array $error) |
|
40
|
|
|
{ |
|
41
|
|
|
// Get service loader |
|
42
|
|
|
$loader = \csphere\core\service\Locator::get(); |
|
43
|
|
|
|
|
44
|
|
|
// Check if installation is going on |
|
45
|
|
|
$plugin = \csphere\core\http\Input::get('get', 'plugin'); |
|
46
|
|
|
|
|
47
|
|
|
if ($plugin == 'install') { |
|
48
|
|
|
|
|
49
|
|
|
// Deactivate driver fallbacks (only) here |
|
50
|
|
|
$loader->rescue(false); |
|
51
|
|
|
|
|
52
|
|
|
$router = new \csphere\core\router\Controller(true); |
|
53
|
|
|
|
|
54
|
|
|
$router->execute(); |
|
55
|
|
|
|
|
56
|
|
|
} else { |
|
57
|
|
|
|
|
58
|
|
|
// Inform template engine about the target |
|
59
|
|
|
\csphere\core\template\Hooks::route('errors', 'config'); |
|
60
|
|
|
|
|
61
|
|
|
// Get view object |
|
62
|
|
|
$view = $loader->load('view'); |
|
63
|
|
|
|
|
64
|
|
|
// Format data for template usage |
|
65
|
|
|
$data = ['file' => $error['file']]; |
|
66
|
|
|
|
|
67
|
|
|
$data['error'] = \csphere\core\translation\Fetch::key( |
|
68
|
|
|
'errors', $error['error'] |
|
69
|
|
|
); |
|
70
|
|
|
|
|
71
|
|
|
// Send data to view and fetch result |
|
72
|
|
|
$view->template('errors', 'core_config', $data); |
|
73
|
|
|
|
|
74
|
|
|
$router = new \csphere\core\router\Controller(); |
|
75
|
|
|
$router->execute(true); |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|