Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/274165

Change subject: [1.27.0-wmf.14] MF cache pollution debug log
......................................................................

[1.27.0-wmf.14] MF cache pollution debug log

Cherry-picked from wmf.11. Switched search string for new mobile edit
section links.

Bug: T124356
Change-Id: I603bf6fefd069d6a19b1833d5082efdaa10a480a
(cherry picked from commit c36bbe47f4c59245fd9a60273f8c3e40d7b7071a)
(cherry picked from commit 0a024d9f86eff23e333d3059d5f8e108d4043629)
---
M includes/parser/ParserCache.php
M includes/parser/ParserOutput.php
2 files changed, 13 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/65/274165/1

diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index bd5afaf..7a8f9e6 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -258,6 +258,13 @@
        public function save( $parserOutput, $page, $popts, $cacheTime = null, 
$revId = null ) {
                $expire = $parserOutput->getCacheExpiry();
                if ( $expire > 0 ) {
+                       if ( strpos( $parserOutput->mText,
+                                       'class="mw-ui-icon mw-ui-icon-element 
mw-ui-icon-edit-enabled edit-page' )
+                               !== false ) {
+                               wfDebugLog( 'T124356', "MF pollution 
({$page->getId()}): getText called from: " . (
+                                       $parserOutput->debug_gettext_trace ?
+                                       implode( ', ', 
$parserOutput->debug_gettext_trace ) : 'nowhere' ) );
+                       }
                        $cacheTime = $cacheTime ?: wfTimestampNow();
                        if ( !$revId ) {
                                $revision = $page->getRevision();
diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index 40c67dd..82b00ff 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -208,6 +208,8 @@
         */
        private $mFlags = [];
 
+       public $debug_gettext_trace = array();
+
        const EDITSECTION_REGEX =
                '#<(?:mw:)?editsection page="(.*?)" 
section="(.*?)"(?:/>|>(.*?)(</(?:mw:)?editsection>))#';
 
@@ -232,6 +234,10 @@
        }
 
        public function getText() {
+               if ( !is_array( $this->debug_gettext_trace ) ) {
+                       $this->debug_gettext_trace = 
(array)$this->debug_gettext_trace;
+               }
+               $this->debug_gettext_trace[] = wfGetAllCallers( false );
                $text = $this->mText;
                if ( $this->mEditSectionTokens ) {
                        $text = preg_replace_callback(

-- 
To view, visit https://gerrit.wikimedia.org/r/274165
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I603bf6fefd069d6a19b1833d5082efdaa10a480a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.15
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to