Jackmcbarn has uploaded a new change for review.

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

Change subject: Don't use vary-revision for self-transclusions
......................................................................

Don't use vary-revision for self-transclusions

Instead of using vary-revision (and forcing a double parse) for pages that
transclude themselves, use ParserOptions::setupFakeRevision so that they can
transclude their new content in just one parse.

Change-Id: If5868327ec31c4f008ab70b03018d7e521dbb095
---
M includes/api/ApiStashEdit.php
M includes/page/WikiPage.php
M includes/parser/Parser.php
3 files changed, 8 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/43/186843/1

diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php
index 09489e4..e8d074f 100644
--- a/includes/api/ApiStashEdit.php
+++ b/includes/api/ApiStashEdit.php
@@ -261,9 +261,12 @@
                $dWhr = array(); // conditions to find deletions
                foreach ( $editInfo->output->getTemplateIds() as $ns => $stuff 
) {
                        foreach ( $stuff as $dbkey => $revId ) {
-                               $cWhr[] = array( 'page_namespace' => $ns, 
'page_title' => $dbkey,
-                                       'page_latest != ' . intval( $revId ) );
-                               $dWhr[] = array( 'page_namespace' => $ns, 
'page_title' => $dbkey );
+                               // don't count ourself, since we inject a fake 
revision for ourself
+                               if ( $ns !== $title->getNamespace() || $dbkey 
!== $title->getDbKey() ) {
+                                       $cWhr[] = array( 'page_namespace' => 
$ns, 'page_title' => $dbkey,
+                                               'page_latest != ' . intval( 
$revId ) );
+                                       $dWhr[] = array( 'page_namespace' => 
$ns, 'page_title' => $dbkey );
+                               }
                        }
                }
                $change = $dbr->selectField( 'page', '1', $dbr->makeList( 
$cWhr, LIST_OR ), __METHOD__ );
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index a0a3c69..d580c86 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -2124,6 +2124,8 @@
                                                }
                                        }
                                );
+                       } else {
+                               $edit->popts->setupFakeRevision( $this->mTitle, 
$edit->pstContent, $user );
                        }
                        $edit->output = $edit->pstContent
                                ? $edit->pstContent->getParserOutput( 
$this->mTitle, $revid, $edit->popts )
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index fc7040a..efbbe7f 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -3894,11 +3894,6 @@
                if ( isset( $stuff['deps'] ) ) {
                        foreach ( $stuff['deps'] as $dep ) {
                                $this->mOutput->addTemplate( $dep['title'], 
$dep['page_id'], $dep['rev_id'] );
-                               if ( $dep['title']->equals( $this->getTitle() ) 
) {
-                                       // If we transclude ourselves, the 
final result
-                                       // will change based on the new version 
of the page
-                                       $this->mOutput->setFlag( 
'vary-revision' );
-                               }
                        }
                }
                return array( $text, $finalTitle );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If5868327ec31c4f008ab70b03018d7e521dbb095
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to