[MediaWiki-commits] [Gerrit] Instrumentation of PageRestoration schema - change (mediawiki...WikimediaEvents)
jenkins-bot has submitted this change and it was merged. Change subject: Instrumentation of PageRestoration schema .. Instrumentation of PageRestoration schema See: https://meta.wikimedia.org/wiki/Schema:PageRestoration Core dependency: If87a73e47def7a4404858f374780c3f1cf4d69b5 Change-Id: Id40347ec268658dc854e4ab2dd38570b19db1477 --- M WikimediaEvents.php M WikimediaEventsHooks.php 2 files changed, 24 insertions(+), 0 deletions(-) Approvals: Phuedx: Looks good to me, approved jenkins-bot: Verified diff --git a/WikimediaEvents.php b/WikimediaEvents.php index ff05117..dfa4b5b 100644 --- a/WikimediaEvents.php +++ b/WikimediaEvents.php @@ -72,5 +72,6 @@ $wgHooks['PageContentSaveComplete'][] = 'WikimediaEventsHooks::onPageContentSaveComplete'; $wgHooks['UserSaveOptions'][] = 'WikimediaEventsHooks::onUserSaveOptions'; $wgHooks['ArticleDeleteComplete'][] = 'WikimediaEventsHooks::onArticleDeleteComplete'; +$wgHooks['ArticleUndelete'][] = 'WikimediaEventsHooks::onArticleUndelete'; $wgHooks['TitleMoveComplete'][] = 'WikimediaEventsHooks::onTitleMoveComplete'; $wgHooks['PageContentInsertComplete'][] = 'WikimediaEventsHooks::onPageContentInsertComplete'; diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php index 0a8abca..b7ab58b 100644 --- a/WikimediaEventsHooks.php +++ b/WikimediaEventsHooks.php @@ -148,6 +148,29 @@ } /** +* Logs article undelete using pageRestored schema +* +* @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleUndelete +* @see https://meta.wikimedia.org/wiki/Schema:PageRestoration +* @param Title $title Title of article restored +* @param boolean $created whether the revision created the page (default false) +* @param string $comment Reason for undeleting the page +* @param integer $oldPageId The ID of the article that was deleted +*/ + public static function onArticleUndelete( $title, $created, $comment, $oldPageId ) { + global $wgUser; + EventLogging::logEvent( 'PageRestoration', 7758372, array( + 'userId' => $wgUser->getId(), + 'userText' => $wgUser->getName(), + 'oldPageId' => $oldPageId, + 'newPageId' => $title->getArticleID(), + 'namespace' => $title->getNamespace(), + 'title' => $title->getDBkey(), + 'comment' => $comment, + ) ); + } + + /** * Logs a page creation event, based on the given parameters. * * Currently, this is either a normal page creation, or an automatic creation -- To view, visit https://gerrit.wikimedia.org/r/133632 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id40347ec268658dc854e4ab2dd38570b19db1477 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/WikimediaEvents Gerrit-Branch: master Gerrit-Owner: Robmoen Gerrit-Reviewer: Mattflaschen Gerrit-Reviewer: Phuedx Gerrit-Reviewer: jenkins-bot <> ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Instrumentation of PageRestoration schema - change (mediawiki...WikimediaEvents)
Robmoen has uploaded a new change for review. https://gerrit.wikimedia.org/r/133632 Change subject: Instrumentation of PageRestoration schema .. Instrumentation of PageRestoration schema See: https://meta.wikimedia.org/wiki/Schema:PageRestoration Core dependency: If87a73e47def7a4404858f374780c3f1cf4d69b5 Change-Id: Id40347ec268658dc854e4ab2dd38570b19db1477 --- M WikimediaEvents.php M WikimediaEventsHooks.php 2 files changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents refs/changes/32/133632/1 diff --git a/WikimediaEvents.php b/WikimediaEvents.php index ff05117..dfa4b5b 100644 --- a/WikimediaEvents.php +++ b/WikimediaEvents.php @@ -72,5 +72,6 @@ $wgHooks['PageContentSaveComplete'][] = 'WikimediaEventsHooks::onPageContentSaveComplete'; $wgHooks['UserSaveOptions'][] = 'WikimediaEventsHooks::onUserSaveOptions'; $wgHooks['ArticleDeleteComplete'][] = 'WikimediaEventsHooks::onArticleDeleteComplete'; +$wgHooks['ArticleUndelete'][] = 'WikimediaEventsHooks::onArticleUndelete'; $wgHooks['TitleMoveComplete'][] = 'WikimediaEventsHooks::onTitleMoveComplete'; $wgHooks['PageContentInsertComplete'][] = 'WikimediaEventsHooks::onPageContentInsertComplete'; diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php index 0a8abca..b40c9df 100644 --- a/WikimediaEventsHooks.php +++ b/WikimediaEventsHooks.php @@ -146,6 +146,27 @@ ) ); return true; } + /** +* Logs article undelete using pageRestored schema +* +* @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleUndelete +* @see https://meta.wikimedia.org/wiki/Schema:PageRestoration +* @param Title $title Title of article restored +* @param Boolean $created whether the revision created the page (default false) +* @param String $comment Reason for undeleting the page +*/ + public static function onArticleUndelete( $title, $created, $comment, $oldPageId ) { + global $wgUser; + EventLogging::logEvent( 'PageRestoration', 7758372, array( + 'userId' => $wgUser->getId(), + 'userText' => $wgUser->getName(), + 'oldPageId' => $oldPageId, + 'newPageId' => $title->getArticleID(), + 'namespace' => $title->getNamespace(), + 'title' => $title->getDBkey(), + 'comment' => $comment, + ) ); + } /** * Logs a page creation event, based on the given parameters. -- To view, visit https://gerrit.wikimedia.org/r/133632 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id40347ec268658dc854e4ab2dd38570b19db1477 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikimediaEvents Gerrit-Branch: master Gerrit-Owner: Robmoen ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits