From 55f3cbe1f66543991391d6453563d0b4bcb5e478 Mon Sep 17 00:00:00 2001
From: Ceeram
Date: Fri, 22 Jun 2012 14:44:47 +0200
Subject: [PATCH 1/2] remove unneeded line
---
lib/Cake/View/XmlView.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/Cake/View/XmlView.php b/lib/Cake/View/XmlView.php
index 2527d11b3..f89efa6ee 100644
--- a/lib/Cake/View/XmlView.php
+++ b/lib/Cake/View/XmlView.php
@@ -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)) {
From b913fe530384df8ce1e4472d4d5669f67babbe84 Mon Sep 17 00:00:00 2001
From: Ceeram
Date: Fri, 15 Jun 2012 14:51:36 +0200
Subject: [PATCH 2/2] better error message in MissingConnectionException when
driver is not enabled
---
lib/Cake/Error/exceptions.php | 8 +++++++-
lib/Cake/Model/Datasource/DboSource.php | 3 ++-
lib/Cake/Model/Model.php | 4 ----
lib/Cake/Test/Case/Error/ExceptionRendererTest.php | 9 +++++++++
lib/Cake/View/Errors/missing_connection.ctp | 4 +++-
5 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/lib/Cake/Error/exceptions.php b/lib/Cake/Error/exceptions.php
index 89d813443..730361305 100644
--- a/lib/Cake/Error/exceptions.php
+++ b/lib/Cake/Error/exceptions.php
@@ -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);
+ }
}
/**
@@ -439,7 +445,7 @@ class MissingPluginException extends CakeException {
}
/**
- * Exception class for AclComponent and Interface implementations.
+ * Exception class for AclComponent and Interface implementations.
*
* @package Cake.Error
*/
diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php
index 04e78e924..56b059481 100644
--- a/lib/Cake/Model/Datasource/DboSource.php
+++ b/lib/Cake/Model/Datasource/DboSource.php
@@ -237,7 +237,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) {
diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php
index 756e908d8..5eaf230dd 100644
--- a/lib/Cake/Model/Model.php
+++ b/lib/Cake/Model/Model.php
@@ -3429,10 +3429,6 @@ class Model extends Object implements CakeEventListener {
}
$this->schemaName = $db->getSchemaName();
-
- if (empty($db) || !is_object($db)) {
- throw new MissingConnectionException(array('class' => $this->name));
- }
}
/**
diff --git a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
index 72f80949b..cafa2f84b 100644
--- a/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
+++ b/lib/Cake/Test/Case/Error/ExceptionRendererTest.php
@@ -559,6 +559,15 @@ class ExceptionRendererTest extends CakeTestCase {
),
500
),
+ array(
+ new MissingConnectionException(array('class' => 'Mysql', 'enabled' => false)),
+ array(
+ '/Missing Database Connection<\/h2>/',
+ '/Mysql requires a database connection/',
+ '/Mysql driver is NOT enabled/'
+ ),
+ 500
+ ),
array(
new MissingDatasourceConfigException(array('config' => 'default')),
array(
diff --git a/lib/Cake/View/Errors/missing_connection.ctp b/lib/Cake/View/Errors/missing_connection.ctp
index 63af7f343..b29fb9fc3 100644
--- a/lib/Cake/View/Errors/missing_connection.ctp
+++ b/lib/Cake/View/Errors/missing_connection.ctp
@@ -21,10 +21,12 @@
:
+
:
-
+
+
: