From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/MagicWord.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'includes/MagicWord.php') diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 7b669249..427a1adc 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -124,6 +124,7 @@ class MagicWord { 'revisionyear', 'revisiontimestamp', 'revisionuser', + 'revisionsize', 'subpagename', 'subpagenamee', 'talkspace', @@ -138,6 +139,8 @@ class MagicWord { 'numberofactiveusers', 'numberofpages', 'currentversion', + 'rootpagename', + 'rootpagenamee', 'basepagename', 'basepagenamee', 'currenttimestamp', @@ -149,7 +152,7 @@ class MagicWord { ); /* Array of caching hints for ParserCache */ - static public $mCacheTTLs = array ( + static public $mCacheTTLs = array( 'currentmonth' => 86400, 'currentmonth1' => 86400, 'currentmonthname' => 86400, @@ -308,9 +311,9 @@ class MagicWord { $this->mId = $id; $wgContLang->getMagic( $this ); if ( !$this->mSynonyms ) { - $this->mSynonyms = array( 'dkjsagfjsgashfajsh' ); + $this->mSynonyms = array( 'brionmademeputthishere' ); + wfProfileOut( __METHOD__ ); throw new MWException( "Error: invalid magic word '$id'" ); - #wfDebugLog( 'exception', "Error: invalid magic word '$id'\n" ); } wfProfileOut( __METHOD__ ); } @@ -326,9 +329,10 @@ class MagicWord { usort( $synonyms, array( $this, 'compareStringLength' ) ); $escSyn = array(); - foreach ( $synonyms as $synonym ) + foreach ( $synonyms as $synonym ) { // In case a magic word contains /, like that's going to happen;) $escSyn[] = preg_quote( $synonym, '/' ); + } $this->mBaseRegex = implode( '|', $escSyn ); $case = $this->mCaseSensitive ? '' : 'iu'; @@ -381,8 +385,9 @@ class MagicWord { * @return string */ function getRegexCase() { - if ( $this->mRegex === '' ) + if ( $this->mRegex === '' ) { $this->initRegex(); + } return $this->mCaseSensitive ? '' : 'iu'; } @@ -509,7 +514,7 @@ class MagicWord { */ function replace( $replacement, $subject, $limit = -1 ) { $res = preg_replace( $this->getRegex(), StringUtils::escapeRegexReplacement( $replacement ), $subject, $limit ); - $this->mModified = !($res === $subject); + $this->mModified = $res !== $subject; return $res; } @@ -525,7 +530,7 @@ class MagicWord { */ function substituteCallback( $text, $callback ) { $res = preg_replace_callback( $this->getVariableRegex(), $callback, $text ); - $this->mModified = !($res === $text); + $this->mModified = $res !== $text; return $res; } @@ -597,14 +602,14 @@ class MagicWord { function replaceMultiple( $magicarr, $subject, &$result ) { $search = array(); $replace = array(); - foreach( $magicarr as $id => $replacement ) { + foreach ( $magicarr as $id => $replacement ) { $mw = MagicWord::get( $id ); $search[] = $mw->getRegex(); $replace[] = $replacement; } $result = preg_replace( $search, $replace, $subject ); - return !($result === $subject); + return $result !== $subject; } /** -- cgit v1.2.3-54-g00ecf