Fix for bug 13251, allows some rebuld scripts to work with Postgres.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Fri, 14 Mar 2008 04:39:18 +0000 (04:39 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Fri, 14 Mar 2008 04:39:18 +0000 (04:39 +0000)
RELEASE-NOTES
maintenance/FiveUpgrade.inc
maintenance/rebuildall.php

index bf9403c..eb8f733 100644 (file)
@@ -85,6 +85,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   for Internet Explorer's sake and standards compliance
 * (bug 13298) Tighter limits on Special:Newpages limits when embedding
 * Email subject in content language instead of sending user's UI language
+* (bug 13251) Allow maintenance rebuild scripts to work with Postgres
 
 === API changes in 1.13 ===
 
index 62574f1..f3d91e3 100644 (file)
@@ -61,9 +61,10 @@ class FiveUpgrade {
         * @access private
         */
        function &newConnection() {
-               global $wgDBadminuser, $wgDBadminpassword;
+               global $wgDBadminuser, $wgDBadminpassword, $wgDBtype;
                global $wgDBserver, $wgDBname;
-               $db = new Database( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+               $dbclass = 'Database' . ucfirst( $wgDBtype ) ;
+               $db = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
                return $db;
        }
 
@@ -75,11 +76,15 @@ class FiveUpgrade {
         * @access private
         */
        function &streamConnection() {
+               global $wgDBtype;
+
                $timeout = 3600 * 24;
                $db =& $this->newConnection();
                $db->bufferResults( false );
-               $db->query( "SET net_read_timeout=$timeout" );
-               $db->query( "SET net_write_timeout=$timeout" );
+        if ($wgDBtype == 'mysql') {
+                       $db->query( "SET net_read_timeout=$timeout" );
+                       $db->query( "SET net_write_timeout=$timeout" );
+               }
                return $db;
        }
 
index 1c2647b..0762295 100644 (file)
@@ -14,12 +14,15 @@ require_once( "refreshLinks.inc" );
 require_once( "rebuildtextindex.inc" );
 require_once( "rebuildrecentchanges.inc" );
 
-$database = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
-
-print "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n";
-dropTextIndex( $database );
-rebuildTextIndex( $database );
-createTextIndex( $database );
+$dbclass = 'Database' . ucfirst( $wgDBtype ) ;
+$database = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
+
+if ($wgDBtype == 'mysql') {
+       print "** Rebuilding fulltext search index (if you abort this will break searching; run this script again to fix):\n";
+       dropTextIndex( $database );
+       rebuildTextIndex( $database );
+       createTextIndex( $database );
+}
 
 print "\n\n** Rebuilding recentchanges table:\n";
 rebuildRecentChangesTable();