Merge "Push all DeferredUpdates to POSTSEND queue when running that queue"
[lhc/web/wiklou.git] / includes / parser / Parser.php
index c83198f..4a78ff8 100644 (file)
@@ -1075,7 +1075,6 @@ class Parser {
         * @return string
         */
        public function doTableStuff( $text ) {
-
                $lines = StringUtils::explode( "\n", $text );
                $out = '';
                $td_history = []; # Is currently a td tag open?
@@ -1279,7 +1278,6 @@ class Parser {
         * @return string
         */
        public function internalParse( $text, $isMain = true, $frame = false ) {
-
                $origText = $text;
 
                // Avoid PHP 7.1 warning from passing $this by reference
@@ -1855,7 +1853,6 @@ class Parser {
         * @return string
         */
        public function replaceExternalLinks( $text ) {
-
                $bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE );
                if ( $bits === false ) {
                        throw new MWException( "PCRE needs to be compiled with "
@@ -3031,7 +3028,6 @@ class Parser {
         * @return string The text of the template
         */
        public function braceSubstitution( $piece, $frame ) {
-
                // Flags
 
                // $text has been filled
@@ -3786,7 +3782,6 @@ class Parser {
         * @return array
         */
        public function argSubstitution( $piece, $frame ) {
-
                $error = false;
                $parts = $piece['parts'];
                $nameWithSpaces = $frame->expand( $piece['title'] );
@@ -3967,7 +3962,6 @@ class Parser {
         * @return string
         */
        public function doDoubleUnderscore( $text ) {
-
                # The position of __TOC__ needs to be recorded
                $mw = MagicWord::get( 'toc' );
                if ( $mw->match( $text ) ) {
@@ -4508,12 +4502,16 @@ class Parser {
                # which may corrupt this parser instance via its wfMessage()->text() call-
 
                # Signatures
-               $sigText = $this->getUserSig( $user );
-               $text = strtr( $text, [
-                       '~~~~~' => $d,
-                       '~~~~' => "$sigText $d",
-                       '~~~' => $sigText
-               ] );
+               if ( strpos( $text, '~~~' ) !== false ) {
+                       $sigText = $this->getUserSig( $user );
+                       $text = strtr( $text, [
+                               '~~~~~' => $d,
+                               '~~~~' => "$sigText $d",
+                               '~~~' => $sigText
+                       ] );
+                       # The main two signature forms used above are time-sensitive
+                       $this->mOutput->setFlag( 'user-signature' );
+               }
 
                # Context links ("pipe tricks"): [[|name]] and [[name (context)|]]
                $tc = '[' . Title::legalChars() . ']';
@@ -4948,7 +4946,6 @@ class Parser {
         * @return string HTML
         */
        public function renderImageGallery( $text, $params ) {
-
                $mode = false;
                if ( isset( $params['mode'] ) ) {
                        $mode = $params['mode'];
@@ -6070,7 +6067,7 @@ class Parser {
                $e = new Exception;
                $this->mInParse = $e->getTraceAsString();
 
-               $recursiveCheck = new ScopedCallback( function() {
+               $recursiveCheck = new ScopedCallback( function () {
                        $this->mInParse = false;
                } );