mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 17:50:06 +00:00
Don't record transclusion of current page from title methods
When the content or categories fields are accessed for the title object of the current page, skip adding an entry in templatelinks. * Cuts 5.9 million rows from enwiki templatelinks, where citation templates use :getContent() to know what date format to use while formatting citations. * Prevents confusion about why a page is shown to transclude itself, frequently brought up on technical support forums. Change-Id: Id6a5e00572031f4a7258c99c6dc0f802385ee5fe
This commit is contained in:
parent
a630e3d129
commit
286add50b5
|
@ -295,11 +295,6 @@ class TitleLibrary extends LibraryBase {
|
|||
return null;
|
||||
}
|
||||
|
||||
// Record in templatelinks, so edits cause the page to be refreshed
|
||||
$this->getParser()->getOutput()->addTemplate(
|
||||
$title, $title->getArticleID(), $title->getLatestRevID()
|
||||
);
|
||||
|
||||
$rev = $this->getParser()->fetchCurrentRevisionRecordOfTitle( $title );
|
||||
|
||||
if ( $title->equals( $this->getTitle() ) ) {
|
||||
|
@ -307,6 +302,11 @@ class TitleLibrary extends LibraryBase {
|
|||
$parserOutput->setOutputFlag( ParserOutputFlags::VARY_REVISION_SHA1 );
|
||||
$parserOutput->setRevisionUsedSha1Base36( $rev ? $rev->getSha1() : '' );
|
||||
wfDebug( __METHOD__ . ": set vary-revision-sha1 for '$title'" );
|
||||
} else {
|
||||
// Record in templatelinks, so edits cause the page to be refreshed
|
||||
$this->getParser()->getOutput()->addTemplate(
|
||||
$title, $title->getArticleID(), $title->getLatestRevID()
|
||||
);
|
||||
}
|
||||
|
||||
if ( !$rev ) {
|
||||
|
@ -355,9 +355,10 @@ class TitleLibrary extends LibraryBase {
|
|||
$parserOutput = $this->getParser()->getOutput();
|
||||
if ( $title->equals( $this->getTitle() ) ) {
|
||||
$parserOutput->setOutputFlag( ParserOutputFlags::VARY_REVISION );
|
||||
}
|
||||
} else {
|
||||
// Record in templatelinks, so edits cause the page to be refreshed
|
||||
$parserOutput->addTemplate( $title, $title->getArticleID(), $title->getLatestRevID() );
|
||||
}
|
||||
|
||||
$categoryTitles = $page->getCategories();
|
||||
$categoryNames = [];
|
||||
|
|
Loading…
Reference in a new issue