From 2105426eed9bb26ca047402d01a81d3863c36f3e Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 13 Jun 2018 20:18:47 +0200 Subject: [PATCH] Provide backwards compatibility for RevisionInsertComplete hook. Call the RevisionInsertComplete from RevisionStore for now, so extensions that still rely on this hook don't break when more code uses RevisionStore instead of Revision. This specifically avoid breaking EventBus and Translate when If610c68f491 is merged. Change-Id: I3356c8250d7934e0089d4627fdebddf7983f194f --- includes/Revision.php | 2 -- includes/Storage/RevisionStore.php | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 548ef8d720..41e889bd2e 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1094,8 +1094,6 @@ class Revision implements IDBAccessObject { // Avoid PHP 7.1 warning of passing $this by reference $revision = $this; - // TODO: hard-deprecate in 1.32 (or even 1.31?) - Hooks::run( 'RevisionInsertComplete', [ &$revision, null, null ] ); return $rec->getId(); } diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index 5b3daf45a4..733b63ab57 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -47,6 +47,7 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use RecentChange; +use Revision; use stdClass; use Title; use User; @@ -489,6 +490,10 @@ class RevisionStore Hooks::run( 'RevisionRecordInserted', [ $rev ] ); + // TODO: deprecate in 1.32! + $legacyRevision = new Revision( $rev ); + Hooks::run( 'RevisionInsertComplete', [ &$legacyRevision, null, null ] ); + return $rev; } -- 2.20.1