Merge "Show ParserOutput warning instead of on the actual page output for ignored...
[lhc/web/wiklou.git] / includes / parser / CoreParserFunctions.php
index 1cc0efc..01cce02 100644 (file)
@@ -456,10 +456,19 @@ class CoreParserFunctions {
                                                $converter->markNoConversion( wfEscapeWikiText( $text ) )
                                        )->inContentLanguage()->text() .
                                        '</span>';
+                       } else {
+                               return '';
                        }
+               } else {
+                       $converter = $parser->getConverterLanguage()->getConverter();
+                       $parser->getOutput()->addWarning(
+                               wfMessage( 'restricted-displaytitle',
+                                       // Message should be parsed, but this param should only be escaped.
+                                       $converter->markNoConversion( wfEscapeWikiText( $text ) )
+                               )->text()
+                       );
+                       $parser->addTrackingCategory( 'restricted-displaytitle-ignored' );
                }
-
-               return '';
        }
 
        /**
@@ -634,7 +643,7 @@ class CoreParserFunctions {
                if ( is_null( $t ) ) {
                        return '';
                }
-               return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getRootText() ) ) );
+               return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getRootText() ) ) );
        }
        public static function basepagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
@@ -648,7 +657,7 @@ class CoreParserFunctions {
                if ( is_null( $t ) ) {
                        return '';
                }
-               return wfEscapeWikiText( wfUrlEncode( str_replace( ' ', '_', $t->getBaseText() ) ) );
+               return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getBaseText() ) ) );
        }
        public static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
@@ -766,6 +775,10 @@ class CoreParserFunctions {
                // fetch revision from cache/database and return the value
                $rev = self::getCachedRevisionObject( $parser, $title );
                $length = $rev ? $rev->getSize() : 0;
+               if ( $length === null ) {
+                       // We've had bugs where rev_len was not being recorded for empty pages, see T135414
+                       $length = 0;
+               }
                return self::formatRaw( $length, $raw );
        }