r98737 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98736‎ | r98737 | r98738 >
Date:02:53, 3 October 2011
Author:krinkle
Status:ok
Tags:
Comment:
[RL2] Fix special page detection.
* r98235 broke equals() for subpages (like Special:Gadgets/foo, which no longer matches and thus the makeGlobalVariablesScript hook wasn't exporting the configuration variables on that subpage, making the js fail).

Using isSpecial per suggestion in r98235 CR.
Modified paths:
  • /branches/RL2/extensions/Gadgets/Gadgets.hooks.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/Gadgets.hooks.php
@@ -329,7 +329,7 @@
330330 }
331331
332332 // Add preferences JS if we're on Special:Preferences
333 - if ( $out->getTitle()->equals( SpecialPage::getTitleFor( 'Preferences' ) ) ) {
 333+ if ( $out->getTitle()->isSpecial( 'Preferences' ) ) {
334334 $out->addModules( 'ext.gadgets.preferences' );
335335 }
336336
@@ -347,9 +347,7 @@
348348 $user = $out->getUser();
349349 // FIXME: This is not a nice way to do it. Maybe we should check for the presence
350350 // of a module instead or something.
351 - if ( $title->equals( SpecialPage::getTitleFor( 'Gadgets' ) ) ||
352 - $title->equals( SpecialPage::getTitleFor( 'Preferences' ) ) )
353 - {
 351+ if ( $title->isSpecial( 'Gadgets' ) || $title->isSpecial( 'Preferences' ) ) {
354352 global $wgGadgetEnableSharing;
355353
356354 // Pass the source data for each source that is used by a repository

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r98235(bug 31088) [Regression] "Create account/log in" should use the current title...aaron18:55, 27 September 2011

Status & tagging log