diff --git a/includes/Notifications/EventDispatcher.php b/includes/Notifications/EventDispatcher.php index fc95e5147..a52abfa6c 100644 --- a/includes/Notifications/EventDispatcher.php +++ b/includes/Notifications/EventDispatcher.php @@ -53,9 +53,6 @@ class EventDispatcher { public static function generateEventsForRevision( array &$events, RevisionRecord $newRevRecord ): void { $services = MediaWikiServices::getInstance(); - $revisionStore = $services->getRevisionStore(); - $oldRevRecord = $revisionStore->getPreviousRevision( $newRevRecord, IDBAccessObject::READ_LATEST ); - $title = Title::newFromLinkTarget( $newRevRecord->getPageAsLinkTarget() ); @@ -71,6 +68,9 @@ class EventDispatcher { return; } + $revisionStore = $services->getRevisionStore(); + $oldRevRecord = $revisionStore->getPreviousRevision( $newRevRecord, IDBAccessObject::READ_LATEST ); + if ( $oldRevRecord !== null ) { $oldItemSet = static::getParsedRevision( $oldRevRecord ); } else {