http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89660

Revision: 89660
Author:   demon
Date:     2011-06-07 17:33:34 +0000 (Tue, 07 Jun 2011)
Log Message:
-----------
Get rid of addNewExtension()/getNewExtensions() method of adding new extensions 
(added in r81266). Since r85021, this isn't necessary because we run old 
updates like we should. Fix the 3 extensions using it. Reverts most of r81266, 
all of r84868, tiny part of r86741. Also ping r89653 which is what caused me to 
look at this again.

Modified Paths:
--------------
    trunk/extensions/CodeReview/CodeReview.php
    trunk/extensions/ConfirmAccount/ConfirmAccount.php
    trunk/extensions/Math/Math.hooks.php
    trunk/phase3/includes/installer/DatabaseInstaller.php
    trunk/phase3/includes/installer/DatabaseUpdater.php

Modified: trunk/extensions/CodeReview/CodeReview.php
===================================================================
--- trunk/extensions/CodeReview/CodeReview.php  2011-06-07 17:19:35 UTC (rev 
89659)
+++ trunk/extensions/CodeReview/CodeReview.php  2011-06-07 17:33:34 UTC (rev 
89660)
@@ -241,7 +241,6 @@
        $base = dirname( __FILE__ );
        switch ( $updater->getDB()->getType() ) {
        case 'mysql':
-               $updater->addNewExtension( 'CodeReview', "$base/codereview.sql" 
);
                $updater->addExtensionUpdate( array( 'addTable', 'code_rev',
                        "$base/codereview.sql", true ) ); // Initial install 
tables
                $updater->addExtensionUpdate( array( 'addField', 'code_rev', 
'cr_diff',
@@ -283,7 +282,6 @@
                        "$base/archives/codereview-repopath.sql", true ) );
                break;
        case 'sqlite':
-               $updater->addNewExtension( 'CodeReview', "$base/codereview.sql" 
);
                $updater->addExtensionUpdate( array( 'addTable', 'code_rev', 
"$base/codereview.sql", true ) );
                $updater->addExtensionUpdate( array( 'addTable', 
'code_signoffs', "$base/archives/code_signoffs.sql", true ) );
                $updater->addExtensionUpdate( array( 'addField', 
'code_signoffs', 'cs_user',

Modified: trunk/extensions/ConfirmAccount/ConfirmAccount.php
===================================================================
--- trunk/extensions/ConfirmAccount/ConfirmAccount.php  2011-06-07 17:19:35 UTC 
(rev 89659)
+++ trunk/extensions/ConfirmAccount/ConfirmAccount.php  2011-06-07 17:33:34 UTC 
(rev 89660)
@@ -274,7 +274,7 @@
                }
        } else {
                if ( $updater->getDB()->getType() == 'mysql' ) {
-                       $updater->addNewExtension( 'ConfirmAccount', 
"$base/ConfirmAccount.sql" );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.sql", true ) );
 
                        $updater->addExtensionUpdate( array( 'addField', 
'account_requests', 'acr_filename',
                                "$base/archives/patch-acr_filename.sql", true ) 
);
@@ -285,7 +285,7 @@
 
                        $updater->addExtensionUpdate( array( 'addIndex', 
'account_requests', 'acr_email', "$base/archives/patch-email-index.sql", true ) 
);
                } else if ( $updater->getDB()->getType() == 'postgres' ) {
-                       $updater->addNewExtension( 'ConfirmAccount', 
"$base/ConfirmAccount.pg.sql" );
+                       $updater->addExtensionUpdate( array( 'addTable', 
'account_requests', "$base/ConfirmAccount.pg.sql", true ) );
 
                        $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_held', "TIMESTAMPTZ" ) );
                        $updater->addExtensionUpdate( array( 'addPgField', 
'account_requests', 'acr_filename', "TEXT" ) );

Modified: trunk/extensions/Math/Math.hooks.php
===================================================================
--- trunk/extensions/Math/Math.hooks.php        2011-06-07 17:19:35 UTC (rev 
89659)
+++ trunk/extensions/Math/Math.hooks.php        2011-06-07 17:33:34 UTC (rev 
89660)
@@ -104,7 +104,10 @@
         * @param  $updater DatabaseUpdater
         * @return bool
         */
-       static function onLoadExtensionSchemaUpdates( $updater ) {
+       static function onLoadExtensionSchemaUpdates( $updater = null ) {
+               if( is_null( $updater ) ) {
+                       throw new MWException( "Math extension is only 
necessary in 1.18 or above" );
+               }
                $map = array(
                        'mysql' => 'math.sql',
                        'sqlite' => 'math.sql',
@@ -115,10 +118,8 @@
                );
                $base = dirname( __FILE__ );
                $type = $updater->getDB()->getType();
-               if ( array_key_exists( $type, $map ) ) {
-                       $file = $map[$type];
-                       $sql = "$base/db/$file";
-                       $updater->addNewExtension( 'CodeReview', $sql );
+               if ( isset( $map[$type] ) ) {
+                       $sql = dirname( __FILE__ ) . '/db/' . $map[$type];
                        $updater->addExtensionTable( 'math', $sql );
                } else {
                        throw new MWException( "Math extension does not 
currently support $type database." );

Modified: trunk/phase3/includes/installer/DatabaseInstaller.php
===================================================================
--- trunk/phase3/includes/installer/DatabaseInstaller.php       2011-06-07 
17:19:35 UTC (rev 89659)
+++ trunk/phase3/includes/installer/DatabaseInstaller.php       2011-06-07 
17:33:34 UTC (rev 89660)
@@ -183,26 +183,9 @@
                if ( !$status->isOK() ) {
                        return $status;
                }
-               $updater = DatabaseUpdater::newForDB( $this->db );
-               $extensionUpdates = $updater->getNewExtensions();
 
-               $ourExtensions = array_map( 'strtolower', $this->getVar( 
'_Extensions' ) );
-
-               foreach( $ourExtensions as $ext ) {
-                       if( isset( $extensionUpdates[$ext] ) ) {
-                               $this->db->begin( __METHOD__ );
-                               $error = $this->db->sourceFile( 
$extensionUpdates[$ext] );
-                               if( $error !== true ) {
-                                       $this->db->rollback( __METHOD__ );
-                                       $status->warning( 
'config-install-tables-failed', $error );
-                               } else {
-                                       $this->db->commit( __METHOD__ );
-                               }
-                       }
-               }
-
                // Now run updates to create tables for old extensions
-               $updater->doUpdates( array( 'extensions' ) );
+               DatabaseUpdater::newForDB( $this->db )->doUpdates( array( 
'extensions' ) );
 
                return $status;
        }

Modified: trunk/phase3/includes/installer/DatabaseUpdater.php
===================================================================
--- trunk/phase3/includes/installer/DatabaseUpdater.php 2011-06-07 17:19:35 UTC 
(rev 89659)
+++ trunk/phase3/includes/installer/DatabaseUpdater.php 2011-06-07 17:33:34 UTC 
(rev 89660)
@@ -31,12 +31,6 @@
        protected $extensionUpdates = array();
 
        /**
-        * Used to hold schema files during installation process
-        * @var array
-        */
-       protected $newExtensions = array();
-
-       /**
         * Handle to the database subclass
         *
         * @var DatabaseBase
@@ -177,23 +171,6 @@
        }
 
        /**
-        * Add a brand new extension to MediaWiki. Used during the initial 
install
-        * @param $ext String Name of extension
-        * @param $sqlPath String Full path to the schema file
-        */
-       public function addNewExtension( $ext, $sqlPath ) {
-               $this->newExtensions[ strtolower( $ext ) ] = $sqlPath;
-       }
-
-       /**
-        * Get the list of extensions that registered a schema with our DB type
-        * @return array
-        */
-       public function getNewExtensions() {
-               return $this->newExtensions;
-       }
-
-       /**
         * Get the list of extension-defined updates
         *
         * @return Array


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to