Permalink
Browse files

Merge branch '2.1' into 2.2

Conflicts:
	lib/Cake/Error/exceptions.php
  • Loading branch information...
2 parents 13077a8 + b913fe5 commit 5e54be4e5ad9954fe84b508278da12135a35dfc1 @markstory markstory committed Jun 23, 2012
@@ -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
*/
@@ -252,7 +252,8 @@ public function __construct($config = null, $autoConnect = true) {
$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
@@ -3167,10 +3167,6 @@ public function setDataSource($dataSource = null) {
}
$this->schemaName = $db->getSchemaName();
-
- if (empty($db) || !is_object($db)) {
- throw new MissingConnectionException(array('class' => $this->name));
- }
}
/**
@@ -560,6 +560,15 @@ public static function testProvider() {
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(
'/<h2>Missing Datasource Configuration<\/h2>/',
@@ -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__)); ?>
@@ -98,7 +98,6 @@ public function render($view = null, $layout = null) {
}
}
$content = Xml::fromArray($data)->asXML();
- $this->Blocks->set('content', $content);
return $content;
}
if ($view !== false && $viewFileName = $this->_getViewFileName($view)) {

0 comments on commit 5e54be4

Please sign in to comment.