mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-23 15:36:47 +00:00
Use EventLogging::submit() to submit analytics events
EventLogging::logEvent() was marked as deprecated at the beginning of 2021 in I0cfd07295d4b51ca4805c79a28a9a4bd64ff7cc9. Bug: T318263 Change-Id: I2d89784cc249e97954c9be05169f3060fd69945f
This commit is contained in:
parent
0e789fdbb4
commit
0f4d04e83f
|
@ -5,14 +5,9 @@ namespace MediaWiki\Extension\EventLogging;
|
|||
class EventLogging {
|
||||
|
||||
/**
|
||||
* @param string $schemaName
|
||||
* @param int $revId
|
||||
* @param string $streamName
|
||||
* @param array $event
|
||||
* @param int $options
|
||||
* @return bool
|
||||
*/
|
||||
public static function logEvent( $schemaName, $revId, $event, $options = 0 ) {
|
||||
return true;
|
||||
public static function submit( string $streamName, array $event ): void {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -224,12 +224,6 @@
|
|||
]
|
||||
},
|
||||
"attributes": {
|
||||
"EventLogging": {
|
||||
"Schemas": {
|
||||
"TemplateDataEditor": "/analytics/legacy/templatedataeditor/1.0.0",
|
||||
"TemplateDataApi": "/analytics/legacy/templatedataapi/1.0.0"
|
||||
}
|
||||
},
|
||||
"VisualEditor": {
|
||||
"PluginModules": [
|
||||
"ext.templateDataGenerator.editPage"
|
||||
|
|
|
@ -181,13 +181,15 @@ class ApiTemplateData extends ApiBase {
|
|||
// template usage for the Technical Wishes topic area see T258917
|
||||
if ( ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ) ) {
|
||||
foreach ( $resp as $pageInfo ) {
|
||||
EventLogging::logEvent(
|
||||
'TemplateDataApi',
|
||||
-1,
|
||||
EventLogging::submit(
|
||||
'eventlogging_TemplateDataApi',
|
||||
[
|
||||
'template_name' => $wikiPageFactory->newFromTitle( $pageInfo['title'] )
|
||||
->getTitle()->getDBkey(),
|
||||
'has_template_data' => !isset( $pageInfo['notemplatedata'] ),
|
||||
'$schema' => '/analytics/legacy/templatedataapi/1.0.0',
|
||||
'event' => [
|
||||
'template_name' => $wikiPageFactory->newFromTitle( $pageInfo['title'] )
|
||||
->getTitle()->getDBkey(),
|
||||
'has_template_data' => !isset( $pageInfo['notemplatedata'] ),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -138,19 +138,21 @@ class Hooks {
|
|||
$generatorUsed = RequestContext::getMain()->getRequest()->getBool( 'TemplateDataGeneratorUsed' );
|
||||
$userEditCount = MediaWikiServices::getInstance()->getUserEditTracker()->getUserEditCount( $user );
|
||||
// Note: We know that irrelevant changes (e.g. whitespace changes) aren't logged here
|
||||
EventLogging::logEvent(
|
||||
'TemplateDataEditor',
|
||||
-1,
|
||||
EventLogging::submit(
|
||||
'eventlogging_TemplateDataEditor',
|
||||
[
|
||||
// Note: The "Done" button is disabled unless something changed, which means it's
|
||||
// very likely (but not guaranteed) the generator was used to make the changes
|
||||
'action' => $generatorUsed ? 'save-tag-edit-generator-used' : 'save-tag-edit-no-generator',
|
||||
'page_id' => $pageId,
|
||||
'page_namespace' => $page->getNamespace(),
|
||||
'page_title' => $page->getDBkey(),
|
||||
'rev_id' => $revisionRecord->getId() ?? 0,
|
||||
'user_edit_count' => $userEditCount ?? 0,
|
||||
'user_id' => $user->getId(),
|
||||
'$schema' => '/analytics/legacy/templatedataeditor/1.0.0',
|
||||
'event' => [
|
||||
// Note: The "Done" button is disabled unless something changed, which means it's
|
||||
// very likely (but not guaranteed) the generator was used to make the changes
|
||||
'action' => $generatorUsed ? 'save-tag-edit-generator-used' : 'save-tag-edit-no-generator',
|
||||
'page_id' => $pageId,
|
||||
'page_namespace' => $page->getNamespace(),
|
||||
'page_title' => $page->getDBkey(),
|
||||
'rev_id' => $revisionRecord->getId() ?? 0,
|
||||
'user_edit_count' => $userEditCount ?? 0,
|
||||
'user_id' => $user->getId(),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue