Nuria has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/379137 )
Change subject: [WIP] Removing instrumentation for outdated schemas ...................................................................... [WIP] Removing instrumentation for outdated schemas Data provided by these schemas is avilable as part of EventBus and also as part of the edit data lake created from mediawiki edit reconstruction: Edit Data Lake: https://wikitech.wikimedia.org/wiki/Analytics/Data_Lake/Edits EventBus: https://wikitech.wikimedia.org/wiki/EventBus#MediaWiki Removing events for: https://meta.wikimedia.org/wiki/Schema:PageCreation https://meta.wikimedia.org/wiki/Schema:PageDeletion https://meta.wikimedia.org/wiki/Schema:PageMove https://meta.wikimedia.org/wiki/Schema:PageRestoration Bug: T171629 Change-Id: Ia4d916761d29cf9e91a15956531ebca0f00ad95f --- M WikimediaEventsHooks.php 1 file changed, 0 insertions(+), 133 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents refs/changes/37/379137/1 diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php index d70b94f..ee71f06 100644 --- a/WikimediaEventsHooks.php +++ b/WikimediaEventsHooks.php @@ -253,139 +253,6 @@ 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 int $id The ID of the article that was deleted - * @return true - */ - public static function onArticleDeleteComplete( WikiPage $article, User $user, $reason, $id ) { - $title = $article->getTitle(); - EventLogging::logEvent( 'PageDeletion', 7481655, [ - 'userId' => $user->getId(), - 'userText' => $user->getName(), - 'pageId' => $id, - 'namespace' => $title->getNamespace(), - 'title' => $title->getDBkey(), - 'comment' => $reason, - ] ); - 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 bool $created whether the revision created the page (default false) - * @param string $comment Reason for undeleting the page - * @param int $oldPageId The ID of the article that was deleted - */ - public static function onArticleUndelete( $title, $created, $comment, $oldPageId ) { - global $wgUser; - EventLogging::logEvent( 'PageRestoration', 7758372, [ - '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 - * of a redirect when a page is moved. - * - * @see https://meta.wikimedia.org/wiki/Schema:PageCreation - * - * @param User $user user creating the page - * @param int $pageId page ID of new page - * @param Title $title title of created page - * @param int $revId revision ID of first revision of created page - */ - protected static function logPageCreation( User $user, $pageId, Title $title, - $revId ) { - EventLogging::logEvent( 'PageCreation', 7481635, [ - 'userId' => $user->getId(), - 'userText' => $user->getName(), - 'pageId' => $pageId, - 'namespace' => $title->getNamespace(), - 'title' => $title->getDBkey(), - 'revId' => $revId, - ] ); - } - - /** - * Logs title moves with the PageMove schema. - * - * @see https://www.mediawiki.org/wiki/Manual:Hooks/TitleMoveComplete - * @see https://meta.wikimedia.org/wiki/Schema:PageMove - * @param Title $oldTitle The title of the old article (moved from) - * @param Title $newTitle The title of the new article (moved to) - * @param User $user The user who moved the article - * @param int $pageId The page ID of the old article - * @param int $redirectId The page ID of the redirect, 0 if a redirect wasn't created - * created - * @param string $reason The reason that the title was moved - * @return bool true in all cases - */ - public static function onTitleMoveComplete( Title $oldTitle, Title $newTitle, User $user, - $pageId, $redirectId, $reason - ) { - EventLogging::logEvent( 'PageMove', 7495717, [ - 'userId' => $user->getId(), - 'userText' => $user->getName(), - 'pageId' => $pageId, - 'oldNamespace' => $oldTitle->getNamespace(), - 'oldTitle' => $oldTitle->getDBkey(), - 'newNamespace' => $newTitle->getNamespace(), - 'newTitle' => $newTitle->getDBkey(), - 'redirectId' => $redirectId, - 'comment' => $reason, - ] ); - - if ( $redirectId !== 0 ) { - // The redirect was not suppressed, so log its creation. - self::logPageCreation( $user, $redirectId, $oldTitle, $oldTitle->getLatestRevID() ); - } - - return true; - } - - /** - * Logs page creations with the PageCreation schema. - * - * @see https://www.mediawiki.org/wiki/Manual:Hooks/PageContentInsertComplete - * @see https://meta.wikimedia.org/wiki/Schema:PageCreation - * @param WikiPage $wikiPage page just created - * @param User $user user who created the page - * @param Content $content content of new page - * @param string $summary summary given by creating user - * @param bool $isMinor whether the edit is marked as minor (not actually possible for new - * pages) - * @param bool $isWatch not used - * @param string $section not used - * @param int $flags bit flags about page creation - * @param Revision $revision first revision of new page - * @return true - */ - public static function onPageContentInsertComplete( WikiPage $wikiPage, User $user, - Content $content, $summary, $isMinor, $isWatch, $section, $flags, Revision $revision ) { - $title = $wikiPage->getTitle(); - self::logPageCreation( $user, $wikiPage->getId(), $title, $revision->getId() ); - - return true; - } /** * Logs edit conflicts with the EditConflict schema. -- To view, visit https://gerrit.wikimedia.org/r/379137 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia4d916761d29cf9e91a15956531ebca0f00ad95f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikimediaEvents Gerrit-Branch: master Gerrit-Owner: Nuria <nu...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits