X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=5256733ee987df16ef710b01c13ec46b45731de0;hp=5b1e86d2520bc8becb5103c0f9cb7ce33defa45e;hb=613ae1c3f205cbcf71e82982c94a18044bb7881f;hpb=ca55cfd87d2efc41b6ab208d60d1cde61f0ac9c0
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 5b1e86d252..5256733ee9 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -245,7 +245,7 @@ class Parser {
public $currentRevisionCache;
/**
- * @var bool Recursive call protection.
+ * @var bool|string Recursive call protection.
* This variable should be treated as if it were private.
*/
public $mInParse = false;
@@ -550,7 +550,8 @@ class Parser {
// Since we're not really outputting HTML, decode the entities and
// then re-encode the things that need hiding inside HTML comments.
$limitReport = htmlspecialchars_decode( $limitReport );
- Hooks::run( 'ParserLimitReport', [ $this, &$limitReport ] );
+ // Run deprecated hook
+ Hooks::run( 'ParserLimitReport', [ $this, &$limitReport ], '1.22' );
// Sanitize for comment. Note 'â' in the replacement is U+2010,
// which looks much like the problematic '-'.
@@ -589,6 +590,14 @@ class Parser {
$this->mTitle->getPrefixedDBkey() );
}
}
+
+ # Wrap non-interface parser output in a
so it can be targeted
+ # with CSS (T37247)
+ $class = $this->mOptions->getWrapOutputClass();
+ if ( $class !== false && !$this->mOptions->getInterfaceMessage() ) {
+ $text = Html::rawElement( 'div', [ 'class' => $class ], $text );
+ }
+
$this->mOutput->setText( $text );
$this->mRevisionId = $oldRevisionId;
@@ -4392,7 +4401,6 @@ class Parser {
$toc = Linker::tocList( $toc, $this->mOptions->getUserLangObj() );
$this->mOutput->setTOCHTML( $toc );
$toc = self::TOC_START . $toc . self::TOC_END;
- $this->mOutput->addModules( 'mediawiki.toc' );
}
if ( $isMain ) {
@@ -4967,6 +4975,7 @@ class Parser {
$ig->setContextTitle( $this->mTitle );
$ig->setShowBytes( false );
+ $ig->setShowDimensions( false );
$ig->setShowFilename( false );
$ig->setParser( $this );
$ig->setHideBadImages();
@@ -6065,9 +6074,13 @@ class Parser {
protected function lock() {
if ( $this->mInParse ) {
throw new MWException( "Parser state cleared while parsing. "
- . "Did you call Parser::parse recursively?" );
+ . "Did you call Parser::parse recursively? Lock is held by: " . $this->mInParse );
}
- $this->mInParse = true;
+
+ // Save the backtrace when locking, so that if some code tries locking again,
+ // we can print the lock owner's backtrace for easier debugging
+ $e = new Exception;
+ $this->mInParse = $e->getTraceAsString();
$recursiveCheck = new ScopedCallback( function() {
$this->mInParse = false;