r107884 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107883‎ | r107884 | r107885 >
Date:13:36, 3 January 2012
Author:yaron
Status:ok
Tags:
Comment:
Follow-up to r107766 and r107767 - those two revisions accidentally removed compatibility with MW 1.16 (which is still supported); other small changes
Modified paths:
  • /trunk/extensions/ReplaceText/SpecialReplaceText.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ReplaceText/SpecialReplaceText.php
@@ -16,7 +16,10 @@
1717
1818 $this->user = $wgUser;
1919 $this->setHeaders();
20 - $wgOut->addModuleStyles( 'mediawiki.special' );
 20+ if ( method_exists( $wgOut, 'addModuleStyles' ) &&
 21+ !is_null( $wgOut->getResourceLoader()->getModule( 'mediawiki.special' ) ) ) {
 22+ $wgOut->addModuleStyles( 'mediawiki.special' );
 23+ }
2124 $this->doSpecialReplaceText();
2225 }
2326
@@ -264,6 +267,7 @@
265268 array(
266269 'type'=>'button',
267270 'id' => 'mw-search-toggleall',
 271+ // 'onclick' value needed for MW 1.16
268272 'onclick' => 'mwToggleSearchCheckboxes("all");',
269273 'value' => wfMsg( 'powersearch-toggleall' )
270274 )
@@ -273,6 +277,7 @@
274278 array(
275279 'type'=>'button',
276280 'id' => 'mw-search-togglenone',
 281+ // 'onclick' value needed for MW 1.16
277282 'onclick' => 'mwToggleSearchCheckboxes("none");',
278283 'value' => wfMsg( 'powersearch-togglenone' )
279284 )
@@ -304,8 +309,12 @@
305310 Xml::submitButton( wfMsg( 'replacetext_continue' ) ) .
306311 Xml::closeElement( 'form' )
307312 );
308 - // add javascript specific to special:search
309 - $wgOut->addModules( 'mediawiki.special.search' );
 313+ // Add Javascript specific to Special:Search
 314+ if ( method_exists( $wgOut, 'addModules' ) ) {
 315+ $wgOut->addModules( 'mediawiki.special.search' );
 316+ } else {
 317+ $wgOut->addScriptFile( 'search.js' );
 318+ }
310319 }
311320
312321 /**
@@ -472,11 +481,11 @@
473482 foreach ( $cuts as $_ ) {
474483 list( $index, $len, ) = $_;
475484 $context .= self::convertWhiteSpaceToHTML(
476 - $wgLang->truncate( substr( $text, 0, $index ), - $cw, '...', false )
 485+ $wgLang->truncate( substr( $text, 0, $index ), - $cw, '...', false )
477486 );
478487 $snippet = self::convertWhiteSpaceToHTML( substr( $text, $index, $len ) );
479488 if ( $use_regex ) {
480 - $targetStr = "/$target/U";
 489+ $targetStr = "/$target/U";
481490 } else {
482491 $targetq = preg_quote( self::convertWhiteSpaceToHTML( $target ), '/' );
483492 $targetStr = "/$targetq/i";
@@ -529,7 +538,7 @@
530539 $tables = array( 'page', 'revision', 'text' );
531540 $vars = array( 'page_id', 'page_namespace', 'page_title', 'old_text' );
532541 if ( $use_regex ) {
533 - $comparisonCond = 'old_text REGEXP ' . $dbr->addQuotes( $search );
 542+ $comparisonCond = 'old_text REGEXP ' . $dbr->addQuotes( $search );
534543 } else {
535544 $any = $dbr->anyString();
536545 $comparisonCond = 'old_text ' . $dbr->buildLike( $any, $search, $any );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r107766search.js doesn't exist anymorenikerabbit08:34, 1 January 2012
r107767Stuff older than 1.16 not supported anymorenikerabbit08:54, 1 January 2012

Status & tagging log