jenkins-bot has submitted this change and it was merged.

Change subject: Log article deletions using the PageDeletion schema
......................................................................


Log article deletions using the PageDeletion schema

Change-Id: I09c43a681ba5d256292173aa3f7dd36d01bb489c
---
M WikimediaEvents.php
1 file changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Mattflaschen: Looks good to me, approved
  Halfak: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/WikimediaEvents.php b/WikimediaEvents.php
index 5b56d6a..6530356 100644
--- a/WikimediaEvents.php
+++ b/WikimediaEvents.php
@@ -146,3 +146,26 @@
 
        return true;
 };
+
+/**
+ * Logs article deletions using the PageDeletion schema.
+ *
+ * @see https://www.mediawiki.org/wiki/Manual:Hooks/ArticleDeleteComplete
+ * @see https://meta.wikimedia.org/wiki/Schema:PageDeletion
+ * @param WikiPage $article The article that was deleted
+ * @param User $user The user that deleted the article
+ * @param string $reason The reason that the article was deleted
+ * @param integer $id The ID of the article that was deleted
+ */
+$wgHooks['ArticleDeleteComplete'][] = function ( WikiPage $article, User 
$user, $reason, $id ) {
+       $title = $article->getTitle();
+       efLogServerSideEvent( 'PageDeletion', 7481655, array(
+               'userId' => $user->getId(),
+               'userText' => $user->getName(),
+               'pageId' => $id,
+               'namespace' => $title->getNamespace(),
+               'title' => $title->getDBkey(),
+               'comment' => $reason,
+       ) );
+       return true;
+};

-- 
To view, visit https://gerrit.wikimedia.org/r/113263
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I09c43a681ba5d256292173aa3f7dd36d01bb489c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: Phuedx <g...@samsmith.io>
Gerrit-Reviewer: Halfak <ahalfa...@wikimedia.org>
Gerrit-Reviewer: Mattflaschen <mflasc...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to