Merge branch '2.1' into 2.2

Conflicts:
	lib/Cake/Error/exceptions.php
This commit is contained in:
mark_story 2012-06-23 16:41:32 -04:00
commit 5e54be4e5a
6 changed files with 21 additions and 8 deletions

View file

@ -337,6 +337,12 @@ class MissingConnectionException extends CakeException {
protected $_messageTemplate = 'Database connection "%s" is missing, or could not be created.';
public function __construct($message, $code = 500) {
if (is_array($message)) {
$message += array('enabled' => true);
}
parent::__construct($message, $code);
}
}
/**
@ -450,7 +456,7 @@ class MissingDispatcherFilterException extends CakeException {
}
/**
* Exception class for AclComponent and Interface implementations.
* Exception class for AclComponent and Interface implementations.
*
* @package Cake.Error
*/

View file

@ -252,7 +252,8 @@ class DboSource extends DataSource {
$this->fullDebug = Configure::read('debug') > 1;
if (!$this->enabled()) {
throw new MissingConnectionException(array(
'class' => get_class($this)
'class' => get_class($this),
'enabled' => false
));
}
if ($autoConnect) {

View file

@ -3167,10 +3167,6 @@ class Model extends Object implements CakeEventListener {
}
$this->schemaName = $db->getSchemaName();
if (empty($db) || !is_object($db)) {
throw new MissingConnectionException(array('class' => $this->name));
}
}
/**

View file

@ -559,6 +559,15 @@ class ExceptionRendererTest extends CakeTestCase {
),
500
),
array(
new MissingConnectionException(array('class' => 'Mysql', 'enabled' => false)),
array(
'/<h2>Missing Database Connection<\/h2>/',
'/Mysql requires a database connection/',
'/Mysql driver is NOT enabled/'
),
500
),
array(
new MissingDatasourceConfigException(array('config' => 'default')),
array(

View file

@ -21,10 +21,12 @@
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', '%s requires a database connection', $class); ?>
</p>
<?php if (!$enabled) : ?>
<p class="error">
<strong><?php echo __d('cake_dev', 'Error'); ?>: </strong>
<?php echo __d('cake_dev', 'Confirm you have created the file : %s.', APP_DIR . DS . 'Config' . DS . 'database.php'); ?>
<?php echo __d('cake_dev', '%s driver is NOT enabled', $class); ?>
</p>
<?php endif; ?>
<p class="notice">
<strong><?php echo __d('cake_dev', 'Notice'); ?>: </strong>
<?php echo __d('cake_dev', 'If you want to customize this error message, create %s.', APP_DIR . DS . 'View' . DS . 'Errors' . DS . basename(__FILE__)); ?>

View file

@ -98,7 +98,6 @@ class XmlView extends View {
}
}
$content = Xml::fromArray($data)->asXML();
$this->Blocks->set('content', $content);
return $content;
}
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {