From 733116d15d22602aecc129b4e170978971dd14ff Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 27 Mar 2013 15:44:48 +0530 Subject: [PATCH] Avoid unnecessary calls to ConnectionManager::enumConnectionObjects() in ClassRegistry::init(). Closes #3724 --- lib/Cake/Utility/ClassRegistry.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Utility/ClassRegistry.php b/lib/Cake/Utility/ClassRegistry.php index 0d69c8da2..c2f6071e9 100644 --- a/lib/Cake/Utility/ClassRegistry.php +++ b/lib/Cake/Utility/ClassRegistry.php @@ -109,7 +109,7 @@ class ClassRegistry { $defaults = $_this->_config['Model']; } $count = count($objects); - $availableDs = array_keys(ConnectionManager::enumConnectionObjects()); + $availableDs = null; foreach ($objects as $settings) { if (is_numeric($settings)) { @@ -153,6 +153,9 @@ class ClassRegistry { $defaultProperties = $reflection->getDefaultProperties(); if (isset($defaultProperties['useDbConfig'])) { $useDbConfig = $defaultProperties['useDbConfig']; + if ($availableDs === null) { + $availableDs = array_keys(ConnectionManager::enumConnectionObjects()); + } if (in_array('test_' . $useDbConfig, $availableDs)) { $useDbConfig = 'test_' . $useDbConfig; }