Add RevisionUndeleted hook to replace ArticleRevisionUndeleted

Bug: T248727
Change-Id: Ic4f771fcb3f1468a78b7eef3ff11686083144154
This commit is contained in:
DannyS712 2020-03-28 03:54:35 +00:00
parent 35eea56a95
commit c2ff5c0355
3 changed files with 12 additions and 1 deletions

View file

@ -586,6 +586,8 @@ because of Phabricator reports.
use the RecentChange_save hook or similar instead.
* The ArticleEditUpdates hook has been deprecated. Please
use the RevisionDataUpdates hook or similar instead.
* The ArticleRevisionUndeleted has been soft deprecated. Please use the new
RevisionUndeleted hook instead.
* LinkHolderArray has been deprecated for public usage and will be
internal part of parser.
* ResourceLoaderFileModule::compileLessFile() has been deprecated, use

View file

@ -685,7 +685,8 @@ $reason: Reason for protect
'ArticlePurge': Before executing "&action=purge".
[&]$wikiPage: WikiPage (object) to purge
'ArticleRevisionUndeleted': After an article revision is restored.
'ArticleRevisionUndeleted': DEPRECATED since 1.35! Use RevisionUndeleted instead.
After an article revision is restored.
[&]$title: the article title
$revision: the revision
$oldPageID: the page ID of the revision when archived (may be null)
@ -2896,6 +2897,9 @@ instead. Called after a revision is inserted into the database.
$data: DEPRECATED! Always null!
$flags: DEPRECATED! Always null!
'RevisionUndeleted': After an article revision is restored.
$revisionRecord: the RevisionRecord that was restored
'SearchableNamespaces': An option to modify which namespaces are searchable.
&$arr: Array of namespaces ($nsId => $name) which will be used.

View file

@ -750,9 +750,14 @@ class PageArchive {
$restored++;
Hooks::run( 'RevisionUndeleted', [ $revision ] );
// TODO: Hard deprecate after replacing uses with RevisionUndeleted
// Deprecated since 1.35
$legacyRevision = new Revision( $revision );
Hooks::run( 'ArticleRevisionUndeleted',
[ &$this->title, $legacyRevision, $row->ar_page_id ] );
$restoredPages[$row->ar_page_id] = true;
}