identify LogPager queries for load balancing
[lhc/web/wiklou.git] / includes / parser / Parser.php
index 6e9e06e..9be75ae 100644 (file)
@@ -420,8 +420,8 @@ class Parser {
                 * d) it is an interface message (which is in the user language)
                 */
                if ( !( $options->getDisableContentConversion()
-                               || isset( $this->mDoubleUnderscores['nocontentconvert'] ) ) )
-               {
+                       || isset( $this->mDoubleUnderscores['nocontentconvert'] ) )
+               {
                        if ( !$this->mOptions->getInterfaceMessage() ) {
                                # The position of the convert() call should not be changed. it
                                # assumes that the links are all replaced and the only thing left
@@ -438,10 +438,10 @@ class Parser {
                 * automatic link conversion.
                 */
                if ( !( $options->getDisableTitleConversion()
-                               || isset( $this->mDoubleUnderscores['nocontentconvert'] )
-                               || isset( $this->mDoubleUnderscores['notitleconvert'] )
-                               || $this->mOutput->getDisplayTitle() !== false ) )
-               {
+                       || isset( $this->mDoubleUnderscores['nocontentconvert'] )
+                       || isset( $this->mDoubleUnderscores['notitleconvert'] )
+                       || $this->mOutput->getDisplayTitle() !== false )
+               {
                        $convruletitle = $this->getConverterLanguage()->getConvRuleTitle();
                        if ( $convruletitle ) {
                                $this->mOutput->setTitleText( $convruletitle );
@@ -541,7 +541,7 @@ class Parser {
                        }
                        foreach ( $this->mOutput->getLimitReportData() as $key => $value ) {
                                if ( wfRunHooks( 'ParserLimitReportFormat',
-                                       array( $key, $value, &$limitReport, false, false )
+                                       array( $key, &$value, &$limitReport, false, false )
                                ) ) {
                                        $keyMsg = wfMessage( $key )->inLanguage( 'en' )->useDatabase( false );
                                        $valueMsg = wfMessage( array( "$key-value-text", "$key-value" ) )
@@ -1696,9 +1696,9 @@ class Parser {
        public static function getExternalLinkRel( $url = false, $title = null ) {
                global $wgNoFollowLinks, $wgNoFollowNsExceptions, $wgNoFollowDomainExceptions;
                $ns = $title ? $title->getNamespace() : false;
-               if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions ) &&
-                               !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions ) )
-               {
+               if ( $wgNoFollowLinks && !in_array( $ns, $wgNoFollowNsExceptions )
+                       && !wfMatchesDomainList( $url, $wgNoFollowDomainExceptions )
+               {
                        return 'nofollow';
                }
                return null;
@@ -1788,14 +1788,14 @@ class Parser {
                        $imagematch = false;
                }
                if ( $this->mOptions->getAllowExternalImages()
-                        || ( $imagesexception && $imagematch ) ) {
+                       || ( $imagesexception && $imagematch ) ) {
                        if ( preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
                                # Image found
                                $text = Linker::makeExternalImage( $url );
                        }
                }
                if ( !$text && $this->mOptions->getEnableImageWhitelist()
-                        && preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
+                       && preg_match( self::EXT_IMAGE_REGEX, $url ) ) {
                        $whitelist = explode( "\n", wfMessage( 'external_image_whitelist' )->inContentLanguage()->text() );
                        foreach ( $whitelist as $entry ) {
                                # Sanitize the regex fragment, make it case-insensitive, ignore blank entries/comments
@@ -1928,11 +1928,10 @@ class Parser {
                                # Still some problems for cases where the ] is meant to be outside punctuation,
                                # and no image is in sight. See bug 2095.
                                #
-                               if ( $text !== '' &&
-                                       substr( $m[3], 0, 1 ) === ']' &&
-                                       strpos( $text, '[' ) !== false
-                               )
-                               {
+                               if ( $text !== ''
+                                       && substr( $m[3], 0, 1 ) === ']'
+                                       && strpos( $text, '[' ) !== false
+                               ) {
                                        $text .= ']'; # so that replaceExternalLinks($text) works later
                                        $m[3] = substr( $m[3], 1 );
                                }
@@ -3387,8 +3386,8 @@ class Parser {
                        if ( !$title->isExternal() ) {
                                if ( $title->isSpecialPage()
                                        && $this->mOptions->getAllowSpecialInclusion()
-                                       && $this->ot['html'] )
-                               {
+                                       && $this->ot['html']
+                               {
                                        // Pass the template arguments as URL parameters.
                                        // "uselang" will have no effect since the Language object
                                        // is forced to the one defined in ParserOptions.
@@ -3506,8 +3505,8 @@ class Parser {
                        $text = wfEscapeWikiText( $text );
                } elseif ( is_string( $text )
                        && !$piece['lineStart']
-                       && preg_match( '/^(?:{\\||:|;|#|\*)/', $text ) )
-               {
+                       && preg_match( '/^(?:{\\||:|;|#|\*)/', $text )
+               {
                        # Bug 529: if the template begins with a table or block-level
                        # element, it should be treated as beginning a new line.
                        # This behavior is somewhat controversial.
@@ -3947,11 +3946,10 @@ class Parser {
                $object = false;
                $text = $frame->getArgument( $argName );
                if ( $text === false && $parts->getLength() > 0
-                 && (
-                       $this->ot['html']
-                       || $this->ot['pre']
-                       || ( $this->ot['wiki'] && $frame->isTemplate() )
-                 )
+                       && ( $this->ot['html']
+                               || $this->ot['pre']
+                               || ( $this->ot['wiki'] && $frame->isTemplate() )
+                       )
                ) {
                        # No match in frame, use the supplied default
                        $object = $parts->item( 0 )->getChildren();
@@ -5432,10 +5430,10 @@ class Parser {
                $params['frame']['caption'] = $caption;
 
                # Will the image be presented in a frame, with the caption below?
-               $imageIsFramed = isset( $params['frame']['frame'] ) ||
-                                                isset( $params['frame']['framed'] ) ||
-                                                isset( $params['frame']['thumbnail'] ) ||
-                                                isset( $params['frame']['manualthumb'] );
+               $imageIsFramed = isset( $params['frame']['frame'] )
+                       || isset( $params['frame']['framed'] )
+                       || isset( $params['frame']['thumbnail'] )
+                       || isset( $params['frame']['manualthumb'] );
 
                # In the old days, [[Image:Foo|text...]] would set alt text.  Later it
                # came to also set the caption, ordinary text after the image -- which
@@ -5762,8 +5760,9 @@ class Parser {
         * Get the revision object for $this->mRevisionId
         *
         * @return Revision|null either a Revision object or null
+        * @since 1.23 (public since 1.23)
         */
-       protected function getRevisionObject() {
+       public function getRevisionObject() {
                if ( !is_null( $this->mRevisionObject ) ) {
                        return $this->mRevisionObject;
                }