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

Change subject: Avoid extra parsing in prepareContentForEdit()
......................................................................


Avoid extra parsing in prepareContentForEdit()

* WikiPage::clear() no longer resets mPreparedEdit
* Also actually made mPreparedEdit protected

bug: 57026
Change-Id: I2c34baaf8b64b204444efa1bfa6ea356e0124c54
---
M includes/WikiPage.php
M tests/phpunit/includes/ArticleTablesTest.php
2 files changed, 7 insertions(+), 3 deletions(-)

Approvals:
  Anomie: Looks good to me, but someone else must approve
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/WikiPage.php b/includes/WikiPage.php
index 576979c..5fc01cc 100644
--- a/includes/WikiPage.php
+++ b/includes/WikiPage.php
@@ -48,8 +48,10 @@
        public $mDataLoaded = false;         // !< Boolean
        public $mIsRedirect = false;         // !< Boolean
        public $mLatest = false;             // !< Integer (false means "not 
loaded")
-       public $mPreparedEdit = false;       // !< Array
        /**@}}*/
+
+       /** @var stdclass Map of cache fields (text, parser output, ect) for a 
proposed/new edit */
+       protected $mPreparedEdit = false;
 
        /**
         * @var int
@@ -242,7 +244,9 @@
                $this->mTimestamp = '';
                $this->mIsRedirect = false;
                $this->mLatest = false;
-               $this->mPreparedEdit = false;
+               // Bug 57026: do not clear mPreparedEdit since 
prepareTextForEdit() already checks
+               // the requested rev ID and immutable content against the 
cached one.
+               // Clearing it can cause extra parses on edit for no reason.
        }
 
        /**
diff --git a/tests/phpunit/includes/ArticleTablesTest.php 
b/tests/phpunit/includes/ArticleTablesTest.php
index c749598..7f9a023 100644
--- a/tests/phpunit/includes/ArticleTablesTest.php
+++ b/tests/phpunit/includes/ArticleTablesTest.php
@@ -24,7 +24,7 @@
                $templates1 = $title->getTemplateLinksFrom();
 
                $wgLang = Language::factory( 'de' );
-               $page->mPreparedEdit = false; // In order to force the 
rerendering of the same wikitext
+               $page = WikiPage::factory( $title ); // In order to force the 
rerendering of the same wikitext
 
                // We need an edit, a purge is not enough to regenerate the 
tables
                $page->doEditContent( new WikitextContent( 
'{{:{{int:history}}}}' ), 'Test code for bug 14404', EDIT_UPDATE, false, $user 
);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c34baaf8b64b204444efa1bfa6ea356e0124c54
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Chad <[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