Provide backwards compatibility for RevisionInsertComplete hook.
authordaniel <daniel.kinzler@wikimedia.de>
Wed, 13 Jun 2018 18:18:47 +0000 (20:18 +0200)
committerAddshore <addshorewiki@gmail.com>
Wed, 13 Jun 2018 18:24:00 +0000 (18:24 +0000)
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
includes/Storage/RevisionStore.php

index 548ef8d..41e889b 100644 (file)
@@ -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();
        }
index 5b3daf4..733b63a 100644 (file)
@@ -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;
        }