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

Revision: 89529
Author:   maxsem
Date:     2011-06-05 19:52:03 +0000 (Sun, 05 Jun 2011)
Log Message:
-----------
Follow-up r89254 and r89481: re-did loading extension updates properly, now 
upgrading extension tables from web interface really works, and without notices

Modified Paths:
--------------
    trunk/phase3/includes/installer/DatabaseUpdater.php
    trunk/phase3/includes/installer/Installer.php
    trunk/phase3/includes/installer/WebInstallerPage.php
    trunk/phase3/maintenance/install.php

Modified: trunk/phase3/includes/installer/DatabaseUpdater.php
===================================================================
--- trunk/phase3/includes/installer/DatabaseUpdater.php 2011-06-05 19:51:31 UTC 
(rev 89528)
+++ trunk/phase3/includes/installer/DatabaseUpdater.php 2011-06-05 19:52:03 UTC 
(rev 89529)
@@ -73,6 +73,7 @@
                }
                $this->maintenance->setDB( $db );
                $this->initOldGlobals();
+               $this->loadExtensions();
                wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
        }
 
@@ -95,6 +96,25 @@
        }
 
        /**
+        * Loads LocalSettings.php, if needed, and initialises everything 
needed for LoadExtensionSchemaUpdates hook
+        */
+       private function loadExtensions() {
+               if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
+                       return; // already loaded
+               }
+               $vars = Installer::getExistingLocalSettings();
+               if ( !$vars ) {
+                       return; // no LocalSettings found
+               }
+               if ( !isset( $vars['wgHooks'] ) && !isset( 
$vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
+                       return;
+               }
+               global $wgHooks, $wgAutoloadClasses;
+               $wgHooks['LoadExtensionSchemaUpdates'] = 
$vars['wgHooks']['LoadExtensionSchemaUpdates'];
+               $wgAutoloadClasses = $wgAutoloadClasses + 
$vars['wgAutoloadClasses'];
+       }
+
+       /**
         * @throws MWException
         * @param DatabaseBase $db
         * @param bool $shared

Modified: trunk/phase3/includes/installer/Installer.php
===================================================================
--- trunk/phase3/includes/installer/Installer.php       2011-06-05 19:51:31 UTC 
(rev 89528)
+++ trunk/phase3/includes/installer/Installer.php       2011-06-05 19:52:03 UTC 
(rev 89529)
@@ -456,7 +456,7 @@
         *
         * @return Array
         */
-       public function getExistingLocalSettings() {
+       public static function getExistingLocalSettings() {
                global $IP;
 
                wfSuppressWarnings();

Modified: trunk/phase3/includes/installer/WebInstallerPage.php
===================================================================
--- trunk/phase3/includes/installer/WebInstallerPage.php        2011-06-05 
19:51:31 UTC (rev 89528)
+++ trunk/phase3/includes/installer/WebInstallerPage.php        2011-06-05 
19:52:03 UTC (rev 89529)
@@ -228,7 +228,7 @@
 class WebInstaller_ExistingWiki extends WebInstallerPage {
        public function execute() {
                // If there is no LocalSettings.php, continue to the installer 
welcome page
-               $vars = $this->parent->getExistingLocalSettings();
+               $vars = Installer::getExistingLocalSettings();
                if ( !$vars ) {
                        return 'skip';
                }

Modified: trunk/phase3/maintenance/install.php
===================================================================
--- trunk/phase3/maintenance/install.php        2011-06-05 19:51:31 UTC (rev 
89528)
+++ trunk/phase3/maintenance/install.php        2011-06-05 19:52:03 UTC (rev 
89529)
@@ -27,6 +27,7 @@
 }
 
 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
+define( 'MEDIAWIKI_INSTALL', true );
 
 require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" );
 


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

Reply via email to