Merge "Include the backtrace in the log for job exceptions"
[lhc/web/wiklou.git] / includes / MagicWord.php
index 86508ec..ae7f8fe 100644 (file)
@@ -138,6 +138,8 @@ class MagicWord {
                'numberofactiveusers',
                'numberofpages',
                'currentversion',
+               'rootpagename',
+               'rootpagenamee',
                'basepagename',
                'basepagenamee',
                'currenttimestamp',
@@ -327,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';
@@ -382,8 +385,9 @@ class MagicWord {
         * @return string
         */
        function getRegexCase() {
-               if ( $this->mRegex === '' )
+               if ( $this->mRegex === '' ) {
                        $this->initRegex();
+               }
 
                return $this->mCaseSensitive ? '' : 'iu';
        }
@@ -510,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;
        }
 
@@ -526,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;
        }
 
@@ -598,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;
        }
 
        /**