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

Change subject: Introduce ParserCacheSaveComplete hook.
......................................................................


Introduce ParserCacheSaveComplete hook.

Rationale: give extensions a way to track which "renderings"
of a page exist in the cache. This is particularly relevant
for multi-lingual wikis that splpit the parser cache by user
language on some pages. In that case, hooking into
ParserAfterParse or LinksUpdateComplete is insufficient to
track all language specific renderings.

Bug: T99511
Change-Id: Iebf526098ca837a7df637c650097119495000c81
---
M RELEASE-NOTES-1.26
M docs/hooks.txt
M includes/parser/ParserCache.php
3 files changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Tim Starling: Looks good to me, approved
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26
index 6f1120e..588dc56 100644
--- a/RELEASE-NOTES-1.26
+++ b/RELEASE-NOTES-1.26
@@ -42,6 +42,7 @@
 * ChangeTags::tagDescription() will return false if the interface message
   for the tag is disabled.
 * Added PageHistoryPager::doBatchLookups hook.
+* Added ParserCacheSaveComplete to ParserCache
 * supportsDirectEditing and supportsDirectApiEditing methods added to
 ContentHandler, to provide a way for ApiEditPage and EditPage to check
 if direct editing of content is allowed. These methods return false,
diff --git a/docs/hooks.txt b/docs/hooks.txt
index e15520c..131986a 100644
--- a/docs/hooks.txt
+++ b/docs/hooks.txt
@@ -2238,6 +2238,14 @@
 &$sectionContent: ref to the content of the section. modify this.
 $showEditLinks: boolean describing whether this section has an edit link
 
+'ParserCacheSaveComplete': Called after a ParserOutput has been committed to
+the parser cache.
+$parserCache: ParserCache object $parserOutput was stored in
+$parserOutput: ParserOutput object that was stored
+$title: Title of the page that was parsed to generate $parserOutput
+$popts: ParserOptions used for generating $parserOutput
+$revId: ID of the revision that was parsed to create $parserOutput
+
 'ParserTestParser': Called when creating a new instance of Parser in
 tests/parser/parserTest.inc.
 $parser: Parser object created
diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php
index dc8bb52..131b7b5 100644
--- a/includes/parser/ParserCache.php
+++ b/includes/parser/ParserCache.php
@@ -276,6 +276,8 @@
 
                        // ...and its pointer
                        $this->mMemc->set( $this->getOptionsKey( $page ), 
$optionsKey, $expire );
+
+                       Hooks::run( 'ParserCacheSaveComplete', array( $this, 
$parserOutput, $page->getTitle(), $popts, $revId ) );
                } else {
                        wfDebug( "Parser output was marked as uncacheable and 
has not been saved.\n" );
                }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebf526098ca837a7df637c650097119495000c81
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: Catrope <roan.katt...@gmail.com>
Gerrit-Reviewer: Chad <ch...@wikimedia.org>
Gerrit-Reviewer: Cscott <canan...@wikimedia.org>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com>
Gerrit-Reviewer: JanZerebecki <jan.wikime...@zerebecki.de>
Gerrit-Reviewer: Parent5446 <tylerro...@gmail.com>
Gerrit-Reviewer: Reedy <s...@reedyboy.net>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to