r89529 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89528‎ | r89529 | r89530 >
Date:19:52, 5 June 2011
Author:maxsem
Status:resolved (Comments)
Tags:
Comment:
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 (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstallerPage.php (modified) (history)
  • /trunk/phase3/maintenance/install.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/install.php
@@ -27,6 +27,7 @@
2828 }
2929
3030 define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
 31+define( 'MEDIAWIKI_INSTALL', true );
3132
3233 require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" );
3334
Index: trunk/phase3/includes/installer/DatabaseUpdater.php
@@ -73,6 +73,7 @@
7474 }
7575 $this->maintenance->setDB( $db );
7676 $this->initOldGlobals();
 77+ $this->loadExtensions();
7778 wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) );
7879 }
7980
@@ -95,6 +96,25 @@
9697 }
9798
9899 /**
 100+ * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook
 101+ */
 102+ private function loadExtensions() {
 103+ if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
 104+ return; // already loaded
 105+ }
 106+ $vars = Installer::getExistingLocalSettings();
 107+ if ( !$vars ) {
 108+ return; // no LocalSettings found
 109+ }
 110+ if ( !isset( $vars['wgHooks'] ) && !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
 111+ return;
 112+ }
 113+ global $wgHooks, $wgAutoloadClasses;
 114+ $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates'];
 115+ $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses'];
 116+ }
 117+
 118+ /**
99119 * @throws MWException
100120 * @param DatabaseBase $db
101121 * @param bool $shared
Index: trunk/phase3/includes/installer/Installer.php
@@ -456,7 +456,7 @@
457457 *
458458 * @return Array
459459 */
460 - public function getExistingLocalSettings() {
 460+ public static function getExistingLocalSettings() {
461461 global $IP;
462462
463463 wfSuppressWarnings();
Index: trunk/phase3/includes/installer/WebInstallerPage.php
@@ -228,7 +228,7 @@
229229 class WebInstaller_ExistingWiki extends WebInstallerPage {
230230 public function execute() {
231231 // If there is no LocalSettings.php, continue to the installer welcome page
232 - $vars = $this->parent->getExistingLocalSettings();
 232+ $vars = Installer::getExistingLocalSettings();
233233 if ( !$vars ) {
234234 return 'skip';
235235 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r89532Followup r89529...reedy21:03, 5 June 2011
r89679MFT r89529, r89532demon19:24, 7 June 2011
r89817Fix for logic error in r89529 causing a notice.tstarling07:48, 10 June 2011
r92339REL1_18 MFT r89401, r89451, r89512, r89513, r89523, r89529, r89532, r89549, r...reedy23:08, 15 July 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89254* trying to create a way to update/install extension already included in the ...freakolowsky13:43, 1 June 2011
r89481Revert r89254:...maxsem21:56, 4 June 2011

Comments

#Comment by Krinkle (talk | contribs)   20:53, 5 June 2011

It appears getExistingLocalSettings() is still used non-statically in other places:

"getExistingLocalSettings" in /trunk as of r89531

#Comment by 😂 (talk | contribs)   16:35, 7 June 2011

This seems to duplicate some of the logic in Installer::includeExtensions(). Perhaps they could be refactored?

#Comment by Tim Starling (talk | contribs)   07:46, 10 June 2011

Not quite without notices:

Notice: Undefined index: LoadExtensionSchemaUpdates in .../includes/installer/DatabaseUpdater.php on line 101

+		if ( !isset( $vars['wgHooks'] ) && !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {

I suppose that was meant to be || not &&

Status & tagging log