mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing database errors when no DB connection present on initial splash page
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7300 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
551cf75bbc
commit
200673dfce
2 changed files with 67 additions and 41 deletions
|
@ -157,9 +157,11 @@ class ErrorHandler extends Object {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$controllerName = str_replace('Controller', '', $className);
|
$controllerName = str_replace('Controller', '', $className);
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'controllerName' => $controllerName,
|
'controller' => $className,
|
||||||
'title' => __('Missing Controller', true)));
|
'controllerName' => $controllerName,
|
||||||
|
'title' => __('Missing Controller', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingController');
|
$this->__outputMessage('missingController');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -172,10 +174,12 @@ class ErrorHandler extends Object {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$controllerName = str_replace('Controller', '', $className);
|
$controllerName = str_replace('Controller', '', $className);
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'controllerName' => $controllerName,
|
'controller' => $className,
|
||||||
'action' => $action,
|
'controllerName' => $controllerName,
|
||||||
'title' => __('Missing Method in Controller', true)));
|
'action' => $action,
|
||||||
|
'title' => __('Missing Method in Controller', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingAction');
|
$this->__outputMessage('missingAction');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -187,9 +191,11 @@ class ErrorHandler extends Object {
|
||||||
function privateAction($params) {
|
function privateAction($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'action' => $action,
|
'controller' => $className,
|
||||||
'title' => __('Trying to access private method in class', true)));
|
'action' => $action,
|
||||||
|
'title' => __('Trying to access private method in class', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('privateAction');
|
$this->__outputMessage('privateAction');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -201,9 +207,11 @@ class ErrorHandler extends Object {
|
||||||
function missingTable($params) {
|
function missingTable($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('model' => $className,
|
$this->controller->set(array(
|
||||||
'table' => $table,
|
'model' => $className,
|
||||||
'title' => __('Missing Database Table', true)));
|
'table' => $table,
|
||||||
|
'title' => __('Missing Database Table', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingTable');
|
$this->__outputMessage('missingTable');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +223,9 @@ class ErrorHandler extends Object {
|
||||||
function missingDatabase($params = array()) {
|
function missingDatabase($params = array()) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('title' => __('Scaffold Missing Database Connection', true)));
|
$this->controller->set(array(
|
||||||
|
'title' => __('Scaffold Missing Database Connection', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingScaffolddb');
|
$this->__outputMessage('missingScaffolddb');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -227,12 +237,13 @@ class ErrorHandler extends Object {
|
||||||
function missingView($params) {
|
function missingView($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'action' => $action,
|
'controller' => $className,
|
||||||
'file' => $file,
|
'action' => $action,
|
||||||
'title' => __('Missing View', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing View', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingView');
|
$this->__outputMessage('missingView');
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Renders the Missing Layout web page.
|
* Renders the Missing Layout web page.
|
||||||
|
@ -244,8 +255,10 @@ class ErrorHandler extends Object {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->layout = 'default';
|
$this->controller->layout = 'default';
|
||||||
$this->controller->set(array('file' => $file,
|
$this->controller->set(array(
|
||||||
'title' => __('Missing Layout', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing Layout', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingLayout');
|
$this->__outputMessage('missingLayout');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -257,8 +270,10 @@ class ErrorHandler extends Object {
|
||||||
function missingConnection($params) {
|
function missingConnection($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('model' => $className,
|
$this->controller->set(array(
|
||||||
'title' => __('Missing Database Connection', true)));
|
'model' => $className,
|
||||||
|
'title' => __('Missing Database Connection', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingConnection');
|
$this->__outputMessage('missingConnection');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -270,9 +285,11 @@ class ErrorHandler extends Object {
|
||||||
function missingHelperFile($params) {
|
function missingHelperFile($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('helperClass' => Inflector::camelize($helper) . "Helper",
|
$this->controller->set(array(
|
||||||
'file' => $file,
|
'helperClass' => Inflector::camelize($helper) . "Helper",
|
||||||
'title' => __('Missing Helper File', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing Helper File', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingHelperFile');
|
$this->__outputMessage('missingHelperFile');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -284,9 +301,11 @@ class ErrorHandler extends Object {
|
||||||
function missingHelperClass($params) {
|
function missingHelperClass($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('helperClass' => Inflector::camelize($helper) . "Helper",
|
$this->controller->set(array(
|
||||||
'file' => $file,
|
'helperClass' => Inflector::camelize($helper) . "Helper",
|
||||||
'title' => __('Missing Helper Class', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing Helper Class', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingHelperClass');
|
$this->__outputMessage('missingHelperClass');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -298,10 +317,12 @@ class ErrorHandler extends Object {
|
||||||
function missingComponentFile($params) {
|
function missingComponentFile($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'component' => $component,
|
'controller' => $className,
|
||||||
'file' => $file,
|
'component' => $component,
|
||||||
'title' => __('Missing Component File', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing Component File', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingComponentFile');
|
$this->__outputMessage('missingComponentFile');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -313,10 +334,12 @@ class ErrorHandler extends Object {
|
||||||
function missingComponentClass($params) {
|
function missingComponentClass($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('controller' => $className,
|
$this->controller->set(array(
|
||||||
'component' => $component,
|
'controller' => $className,
|
||||||
'file' => $file,
|
'component' => $component,
|
||||||
'title' => __('Missing Component Class', true)));
|
'file' => $file,
|
||||||
|
'title' => __('Missing Component Class', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingComponentClass');
|
$this->__outputMessage('missingComponentClass');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -328,8 +351,10 @@ class ErrorHandler extends Object {
|
||||||
function missingModel($params) {
|
function missingModel($params) {
|
||||||
extract($params, EXTR_OVERWRITE);
|
extract($params, EXTR_OVERWRITE);
|
||||||
|
|
||||||
$this->controller->set(array('model' => $className,
|
$this->controller->set(array(
|
||||||
'title' => __('Missing Model', true)));
|
'model' => $className,
|
||||||
|
'title' => __('Missing Model', true)
|
||||||
|
));
|
||||||
$this->__outputMessage('missingModel');
|
$this->__outputMessage('missingModel');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -343,4 +368,5 @@ class ErrorHandler extends Object {
|
||||||
echo $this->controller->output;
|
echo $this->controller->output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -77,9 +77,9 @@ endif;
|
||||||
</p>
|
</p>
|
||||||
<?php
|
<?php
|
||||||
if (isset($filePresent)):
|
if (isset($filePresent)):
|
||||||
uses('model' . DS . 'connection_manager');
|
uses('model' . DS . 'connection_manager');
|
||||||
$db = ConnectionManager::getInstance();
|
$db = ConnectionManager::getInstance();
|
||||||
$connected = $db->getDataSource('default');
|
@$connected = $db->getDataSource('default');
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<?php
|
<?php
|
||||||
|
|
Loading…
Reference in a new issue