Turned Database::patchPath() into a member function, less globals to care about
authorMax Semenik <maxsem@users.mediawiki.org>
Mon, 11 Oct 2010 15:29:48 +0000 (15:29 +0000)
committerMax Semenik <maxsem@users.mediawiki.org>
Mon, 11 Oct 2010 15:29:48 +0000 (15:29 +0000)
includes/db/Database.php
includes/installer/DatabaseUpdater.php

index e249ccb..d29d142 100644 (file)
@@ -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";
                }
index 8a32808..bb7bf11 100644 (file)
@@ -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 ) );
                }
        }