From f2b99c88e0a1d8d5abb0b990d15de14979ae001a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 7 Dec 2007 22:51:00 +0000 Subject: [PATCH] *Add hook when a revision is restored (for flaggedrevs, next commit) --- docs/hooks.txt | 5 +++++ includes/SpecialUndelete.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/docs/hooks.txt b/docs/hooks.txt index 6330f79a47..65aa2db0be 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -325,6 +325,11 @@ $moveonly: boolean whether it was for move only or not 'ArticlePurge': before executing "&action=purge" $article: article (object) to purge +'ArticleRevisionUndeleted' 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) + 'ArticleRollbackComplete': after an article rollback is completed $article: the article that was edited $user: the user who did the rollback diff --git a/includes/SpecialUndelete.php b/includes/SpecialUndelete.php index 06d66a2b85..1fe11c1079 100644 --- a/includes/SpecialUndelete.php +++ b/includes/SpecialUndelete.php @@ -432,6 +432,7 @@ class PageArchive { 'ar_minor_edit', 'ar_flags', 'ar_text_id', + 'ar_page_id', 'ar_len' ), /* WHERE */ array( 'ar_namespace' => $this->title->getNamespace(), @@ -476,6 +477,8 @@ class PageArchive { ) ); $revision->insertOn( $dbw ); $restored++; + + wfRunHooks( 'ArticleRevisionUndeleted', array( &$this->title, $revision, $row->ar_page_id ) ); } // Was anything restored at all? if($restored == 0) -- 2.20.1