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

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)
---
M includes/parser/ParserCache.php
M includes/parser/ParserOutput.php
2 files changed, 13 insertions(+), 0 deletions(-)

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



diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index 0eba166..89a3f3b 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 656e580..d39a354 100644
--- a/includes/parser/ParserOutput.php
+++ b/includes/parser/ParserOutput.php
@@ -208,6 +208,8 @@
         */
        private $mFlags = array();
 
+       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/273655
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I603bf6fefd069d6a19b1833d5082efdaa10a480a
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.14
Gerrit-Owner: Legoktm <[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