Modify PageSaveComplete hook to use EditResult

This hook was introduced in 1.35 and the EditResult parameter makes
$originalRevId and $undidRevId params redundant.

I also uploaded cross-repo dependent patches for extensions that
already use this hook.

Bug: T254074
Depends-On: I3922d9a92242c9a6469058a2a2c2a95891e9e429
Depends-On: I52e7d6198c000100e9c1013ebc865c1f9b836fe4
Change-Id: I551702327c6e2b6dab9e0eda52f03ebb9382d050
This commit is contained in:
Ostrzyciel 2020-06-22 11:40:39 +02:00
parent 52f1bfa61b
commit de602706c8
3 changed files with 8 additions and 11 deletions

View file

@ -2826,12 +2826,11 @@ class HookRunner implements
}
public function onPageSaveComplete( $wikiPage, $user, $summary, $flags,
$revisionRecord, $originalRevId, $undidRevId
$revisionRecord, $editResult
) {
return $this->container->run(
'PageSaveComplete',
[ $wikiPage, $user, $summary, $flags, $revisionRecord,
$originalRevId, $undidRevId ]
[ $wikiPage, $user, $summary, $flags, $revisionRecord, $editResult ]
);
}

View file

@ -3,6 +3,7 @@
namespace MediaWiki\Storage\Hook;
use MediaWiki\Revision\RevisionRecord;
use MediaWiki\Storage\EditResult;
use MediaWiki\User\UserIdentity;
use WikiPage;
@ -21,10 +22,9 @@ interface PageSaveCompleteHook {
* @param string $summary Edit summary/comment
* @param int $flags Flags passed to WikiPage::doEditContent()
* @param RevisionRecord $revisionRecord New RevisionRecord of the article
* @param int|bool $originalRevId If the edit restores or repeats an earlier revision (such as a
* rollback or a null revision), the ID of that earlier revision. False otherwise.
* (Used to be called $baseRevId.)
* @param int $undidRevId Rev ID (or 0) this edit undid
* @param EditResult $editResult Object storing information about the effects of this edit,
* including which edits were reverted and which edit is this based on (for reverts and null
* edits).
* @return bool|void True or no return value to continue or false to stop other hook handlers
* from being called; save cannot be aborted
*/
@ -34,7 +34,6 @@ interface PageSaveCompleteHook {
$summary,
$flags,
$revisionRecord,
$originalRevId,
$undidRevId
$editResult
);
}

View file

@ -1322,8 +1322,7 @@ class PageUpdater {
$summary->text,
$flags,
$newRevisionRecord,
$editResult->getOriginalRevisionId(),
$editResult->getUndidRevId()
$editResult
);
// Deprecated since 1.35