-
Notifications
You must be signed in to change notification settings - Fork 0
/
app_error.php
64 lines (56 loc) · 2.15 KB
/
app_error.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
<?php
//App::import('Model', 'CakeSchema', false);
App::import('Lib', 'Migrations.MigrationVersion');
class AppError extends ErrorHandler {
function __construct($method, $messages, $controller = false) {
$this->controller = &$controller;
if ( $controller === false ) {
parent::__construct($method, $messages);
}
}
function _outputMessage($template) {
if ($template == 'missingTable') {
$this->upgradeRequired();
$this->controller->redirect(array(
'controller' => 'setup',
'action' => 'go',
'dashboard' => true
));
}
// Startup The Blogmill Component to get the current theme info.
$this->controller->Blogmill->startup($this->controller);
$this->plugin = $this->controller->activeThemePlugin;
$this->controller->render($template, $this->controller->layout);
$this->controller->afterFilter();
echo $this->controller->output;
}
public function error404($params) {
$this->controller->name = 'CakeError';
$this->controller->action = 'error404';
$this->controller->header("HTTP/1.0 404 Not Found");
echo $this->controller->render('/errors/error404');
$this->_stop();
}
public function upgradeRequired() {
$this->controller->Blogmill->checkUpgradeRequired();
}
private function __installPluginTables() {
// Load plugin schemas
$plugins = Configure::listObjects('plugin');
foreach( $plugins as $plugin ) {
$file = APP . 'plugins' . DS . Inflector::underscore($plugin) . DS . 'config' . DS . 'schema' . DS . 'schema.php';
$path = App::pluginPath($plugin) . 'config' . DS . 'schema';
$schema = new CakeSchema(array(
'name' => Inflector::underscore($plugin),
'plugin' => $plugin,
'path' => $path
));
$schema = $schema->load();
if ($schema) {
foreach( $schema->tables as $table => $fields ) {
$db->execute($db->createSchema($schema, $table));
}
}
}
}
}