r84165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84164‎ | r84165 | r84166 >
Date:13:29, 17 March 2011
Author:yaron
Status:deferred (Comments)
Tags:
Comment:
Added backwards compatibility for MW < 1.17
Modified paths:
  • /trunk/extensions/ReplaceText/SpecialReplaceText.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ReplaceText/SpecialReplaceText.php
@@ -23,7 +23,9 @@
2424
2525 $this->user = $wgUser;
2626 $this->setHeaders();
27 - $wgOut->addModuleStyles( 'mediawiki.special' );
 27+ if ( method_exists( $wgOut, 'addModuleStyles' ) ) {
 28+ $wgOut->addModuleStyles( 'mediawiki.special' );
 29+ }
2830 $this->doSpecialReplaceText();
2931 }
3032

Follow-up revisions

RevisionCommit summaryAuthorDate
r84176Fix for loading a module in MW 1.17 - follow-up to r84165 and r83789yaron16:06, 17 March 2011

Comments

#Comment by Reach Out to the Truth (talk | contribs)   13:52, 17 March 2011

The mediawiki.special module doesn't exist until MediaWiki 1.18, and ResourceLoader throws a fatal error if you try to add a nonexistent module. So this won't work in 1.17.

#Comment by Yaron Koren (talk | contribs)   14:03, 17 March 2011

Thanks for letting me know about that. Is there any way to check whether a module exists?

#Comment by Bryan (talk | contribs)   14:36, 17 March 2011

Catch the exception?

#Comment by Yaron Koren (talk | contribs)   14:37, 17 March 2011

Do you know what the exception is? Unfortunately, I have no way at the moment to test with MW 1.17 - just 1.16 and 1.18.

#Comment by Bryan (talk | contribs)   14:42, 17 March 2011

Just checked, you can't catch the exception because it will be thrown much later when the output page is built.

What should work: !is_null( $wgOut->getResourceLoader()->getModule( 'mediawiki.special' ) )

#Comment by Yaron Koren (talk | contribs)   14:51, 17 March 2011

Thanks!

Status & tagging log