From f4fd71665a303c26ea093e53b6accb261a90f855 Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Thu, 19 Jul 2012 14:14:12 +1200 Subject: [PATCH] BUG New capture method wouldnt carry test db name through to clone in tests --- code/search/SearchUpdater.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/code/search/SearchUpdater.php b/code/search/SearchUpdater.php index 30cb421..8e02acd 100644 --- a/code/search/SearchUpdater.php +++ b/code/search/SearchUpdater.php @@ -46,8 +46,8 @@ class SearchUpdater extends Object { static function bind_manipulation_capture() { global $databaseConfig; - $connector = DB::getConn(); - if (!$connector || @$connector->isManipulationCapture) return; // If not yet set, or its already captured, just return + $current = DB::getConn(); + if (!$current || @$current->isManipulationCapture) return; // If not yet set, or its already captured, just return $type = $databaseConfig['type']; $file = TEMP_FOLDER."/.cache.SMC.$type"; @@ -69,8 +69,10 @@ class SearchUpdater extends Object { require_once($file); $dbClass = 'SearchManipulateCapture_'.$type; - $conn = new $dbClass($databaseConfig); - DB::setConn($conn); + $captured = new $dbClass($databaseConfig); + // The connection might have had it's name changed (like if we're currently in a test) + $captured->selectDatabase($current->currentDatabase()); + DB::setConn($captured); } static $dirty = array(); static $dirtycount = 0;