jenkins-bot has submitted this change and it was merged.

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


[1.27.0-wmf.15] 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, 15 insertions(+), 0 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index bd5afaf..c94c83d 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -258,6 +258,15 @@
        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' ) .
+                                       ', save from ' . wfGetAllCallers( false 
)
+                               );
+                       }
                        $cacheTime = $cacheTime ?: wfTimestampNow();
                        if ( !$revId ) {
                                $revision = $page->getRevision();
diff --git a/includes/parser/ParserOutput.php b/includes/parser/ParserOutput.php
index 40c67dd..5e7b2af 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -208,6 +208,8 @@
         */
        private $mFlags = [];
 
+       public $debug_gettext_trace = [];
+
        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: merged
Gerrit-Change-Id: I603bf6fefd069d6a19b1833d5082efdaa10a480a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.15
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to