Aude has uploaded a new change for review. https://gerrit.wikimedia.org/r/203071
Change subject: Add WikiPageDoEditUpdatesBeforeCache hook in WikiPage ...................................................................... Add WikiPageDoEditUpdatesBeforeCache hook in WikiPage During an edit, when Content::getParserOutput is called, the revision id is not set. Some ParserOutput metadata might require revision id, and it needs to be set at a point during save after the revision id has been set, and before the revision is cached. ArticleEditUpdates happens too late in the process, after revision is cached. This introduces a new hook 'WikiPageDoEditUpdatesBeforeCache' earlier in the process, during doEditUpdates to provide this ability. Change-Id: I0cd46d503e003837f262a73ee73ed80904832e23 --- M RELEASE-NOTES-1.26 M docs/hooks.txt M includes/page/WikiPage.php 3 files changed, 13 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/71/203071/1 diff --git a/RELEASE-NOTES-1.26 b/RELEASE-NOTES-1.26 index 46509be..37874cc 100644 --- a/RELEASE-NOTES-1.26 +++ b/RELEASE-NOTES-1.26 @@ -11,6 +11,9 @@ === Configuration changes in 1.26 === === New features in 1.26 === +* Added new hook, 'WikiPageDoEditUpdatesBeforeCache', to provide access to +information about an edit and modifying it, with knowledge of its revision id +and other revision data, before a save is completed and cached. ==== External libraries ==== diff --git a/docs/hooks.txt b/docs/hooks.txt index 877b7ed..971a527 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -3247,6 +3247,14 @@ $content: the Content to generate updates for &$updates: the array of DataUpdate objects. Hook function may want to add to it. +'WikiPageDoEditUpdatesBeforeCache': modify edit, such as its parser output, with +knowledge of the revision id and details, before completing the save and storing +in ParserCache (if enabled). +$page: The WikiPage object. +$revision: The Revision of the edit. +&$editInfo Data holder that includes the parser output ($editInfo->output) for +that page after the change. + 'wfShellWikiCmd': Called when generating a shell-escaped command line string to run a MediaWiki cli script. &$script: MediaWiki cli script path diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 6242a54..1ba0cb6 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2181,6 +2181,8 @@ $editInfo = $this->mPreparedEdit; } + Hooks::run( 'WikiPageDoEditUpdatesBeforeCache', array( $this, $revision, &$editInfo ) ); + // Save it to the parser cache if ( $wgEnableParserCache ) { $parserCache = ParserCache::singleton(); -- To view, visit https://gerrit.wikimedia.org/r/203071 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0cd46d503e003837f262a73ee73ed80904832e23 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Aude <aude.w...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits