From 797bc0c5f77812a61982c47485ee5c7abd6688b4 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Mon, 11 Oct 2010 15:29:48 +0000 Subject: [PATCH] Turned Database::patchPath() into a member function, less globals to care about --- includes/db/Database.php | 9 +++++---- includes/installer/DatabaseUpdater.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index e249ccb2a0..d29d142f70 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2412,11 +2412,12 @@ abstract class DatabaseBase implements DatabaseType { * @param $patch String The name of the patch, like patch-something.sql * @return String Full path to patch file */ - public static function patchPath( $patch ) { - global $wgDBtype, $IP; + public function patchPath( $patch ) { + global $IP; - if ( file_exists( "$IP/maintenance/$wgDBtype/archives/$patch" ) ) { - return "$IP/maintenance/$wgDBtype/archives/$patch"; + $dbType = $this->getType(); + if ( file_exists( "$IP/maintenance/$dbType/archives/$patch" ) ) { + return "$IP/maintenance/$dbType/archives/$patch"; } else { return "$IP/maintenance/archives/$patch"; } diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 8a32808eb0..bb7bf1171e 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -274,7 +274,7 @@ abstract class DatabaseUpdater { if ( $isFullPath ) { $this->db->sourceFile( $path ); } else { - $this->db->sourceFile( DatabaseBase::patchPath( $path ) ); + $this->db->sourceFile( $this->db->patchPath( $path ) ); } } -- 2.20.1