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

Change subject: Convert XAnalytics to use extension registration
......................................................................


Convert XAnalytics to use extension registration

Bug: T139906
Change-Id: I3ca3b8b0d98dbee65816b408213332d7018df40a
---
M XAnalytics.php
A extension.json
2 files changed, 41 insertions(+), 31 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/XAnalytics.php b/XAnalytics.php
index 3fd7dc4..aff27a2 100644
--- a/XAnalytics.php
+++ b/XAnalytics.php
@@ -1,32 +1,14 @@
 <?php
-/**
- * Emit structured analytics data via an X-Analytics HTTP header.
- *
- * @see https://wikitech.wikimedia.org/wiki/X-Analytics
- * @author Ori Livneh <[email protected]>
- * @license GPLv2
- * @version 0.1
- */
-
-$wgExtensionCredits['other'][] = array(
-       'path' => __FILE__,
-       'name' => 'XAnalytics',
-       'version' => '0.1',
-       'url' => 'https://wikitech.wikimedia.org/wiki/X-Analytics',
-       'author' => 'Ori Livneh',
-       'descriptionmsg' => 'xanalytics-desc',
-       'license-name' => 'GPL-2.0+'
-);
-
-// Messages
-
-$wgMessagesDirs['XAnalytics'] = __DIR__ . '/i18n';
-
-// Autoload
-
-$wgAutoloadClasses['XAnalytics'] = __DIR__ . '/XAnalytics.class.php';
-
-// Hooks
-
-$wgHooks['BeforePageDisplay'][] = 'XAnalytics::onBeforePageDisplay';
-$wgHooks['APIAfterExecute'][] = 'XAnalytics::onAPIAfterExecute';
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'XAnalytics' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['XAnalytics'] = __DIR__ . '/i18n';
+       /*wfWarn(
+               'Deprecated PHP entry point used for XAnalytics extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );*/
+       return;
+} else {
+       die( 'This version of the XAnalytics extension requires MediaWiki 
1.25+' );
+}
\ No newline at end of file
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..f11ec2f
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,28 @@
+{
+       "name": "XAnalytics",
+       "license-name": "GPL-2.0+",
+       "url": "https://wikitech.wikimedia.org/wiki/X-Analytics";,
+       "descriptionmsg": "xanalytics-desc",
+       "author": [
+               "Ori Livneh"
+       ],
+       "version": "0.1",
+       "type": "other",
+       "AutoloadClasses": {
+               "XAnalytics": "XAnalytics.class.php"
+       },
+       "MessageDirs": {
+               "XAnalytics": [
+                       "i18n"
+               ]
+       },
+       "Hooks": {
+               "BeforePageDisplay": [
+                       "XAnalytics::onBeforePageDisplay"
+               ],
+               "APIAfterExecute": [
+                       "XAnalytics::onAPIAfterExecute"
+               ]
+       },
+       "manifest_version": 1
+}
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3ca3b8b0d98dbee65816b408213332d7018df40a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/XAnalytics
Gerrit-Branch: master
Gerrit-Owner: MtDu <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MtDu <[email protected]>
Gerrit-Reviewer: Nemo bis <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to