Florianschmidtwelzow has submitted this change and it was merged.

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


Convert extension to extension registration

Change-Id: I0be1f29a0316ff8b462112b58092dd5429cc1464
---
M GoogleAnalyticsTopPages.php
A extension.json
2 files changed, 75 insertions(+), 107 deletions(-)

Approvals:
  Florianschmidtwelzow: Verified; Looks good to me, approved



diff --git a/GoogleAnalyticsTopPages.php b/GoogleAnalyticsTopPages.php
index 3cc8169..9e97c2f 100644
--- a/GoogleAnalyticsTopPages.php
+++ b/GoogleAnalyticsTopPages.php
@@ -1,112 +1,37 @@
 <?php
-       /**
-       GoogleAnalyticsTopPages License
-       Copyright (c) 2014 Florian Schmidt
+/**
+GoogleAnalyticsTopPages License
+Copyright (c) 2014 Florian Schmidt
 
-       Permission is hereby granted, free of charge, to any person obtaining a 
copy
-       of this software and associated documentation files (the "Software"), 
to deal
-       in the Software without restriction, including without limitation the 
rights
-       to use, copy, modify, merge, publish, distribute, sublicense, and/or 
sell
-       copies of the Software, and to permit persons to whom the Software is
-       furnished to do so, subject to the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
-       The above copyright notice and this permission notice shall be included 
in all
-       copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
 
-       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
OR
-       IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-       FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
THE
-       AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-       LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
-       OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 
IN THE
-       SOFTWARE.
-       */
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
 
-       if ( !defined( 'MEDIAWIKI' ) ) {
-               die( 'This is an extension for Mediawiki and can not run 
standalone.' );
-       }
-
-       $wgExtensionCredits['parserhook'][] = array(
-               'path' => __FILE__,
-               'name' => 'GoogleAnalyticsTopPages',
-               'author' => 'Florian Schmidt',
-               'url' => 
'https://www.mediawiki.org/wiki/Extension:GoogleAnalyticsTopPages',
-               'descriptionmsg' => 'googleanalyticstoppages-desc',
-               'version'  => '0.0.1',
-               'license-name' => "MIT",
-       );
-
-       $dir = __DIR__;
-
-       // Messages
-       $wgMessagesDirs['GoogleAnalyticsTopPages'] = $dir . '/i18n';
-
-       // Autoload Classes
-       $wgAutoloadClasses[ 'GoogleAnalyticsTopPages' ] =
-               $dir . '/includes/GoogleAnalyticsTopPages.body.php';
-       $wgAutoloadClasses[ 'GoogleAnalyticsTopPagesHooks' ] =
-               $dir . '/includes/GoogleAnalyticsTopPages.hooks.php';
-       $wgAutoloadClasses[ 'SpecialGoogleAnalyticsTopPages' ] =
-               $dir . '/includes/specials/SpecialGoogleAnalyticsTopPages.php';
-       $wgAutoloadClasses[ 'ApiGooglePageStatsUpdate' ] =
-               $dir . '/includes/api/ApiGooglePageStatsUpdate.php';
-
-       // Special Page
-       $wgSpecialPages[ 'GoogleAnalyticsTopPages' ] = 
'SpecialGoogleAnalyticsTopPages';
-
-       // API Modules
-       $wgAPIModules['googlepagestatsupdate'] = 'ApiGooglePageStatsUpdate';
-
-       // Hooks
-       $wgHooks['LoadExtensionSchemaUpdates'][] =
-               'GoogleAnalyticsTopPagesHooks::onLoadExtensionSchemaUpdates';
-       $wgHooks['ParserFirstCallInit'][] = 
'GoogleAnalyticsTopPagesHooks::onParserFirstCallInit';
-
-       // Configuration variables
-
-       /**
-        * Service account name of the service account to use for api requests 
(to Google Analytics API).
-        * Can be found in Google Developer console.
-        *
-        * @var string
-        */
-       $wgGATPServiceAccountName = '';
-
-       /**
-        * Absolute path to certificate file to access the service account. Can 
be downloaded
-        * from Google Developer console. Be sure to put the certificate 
somewhere, where only
-        * you can access it! ({wikiroot}/ isn't a good idea!)
-        *
-        * @var string
-        */
-       $wgGATPKeyFileLocation = '';
-
-       /**
-        * Optional name of this api app.
-        *
-        * @var string
-        */
-       $wgGATPAppName = "googleanalyticstoppages";
-
-       /**
-        * Google Analytics profile id to get the data from. Your service 
account need to have at
-        * least read access to access the data. The profile ID isn't the 
UA-XXXX string!
-        *
-        * @var string
-        */
-       $wgGATPProfileId = '';
-
-       /**
-        * Interval in days (from today) to get visitor data.
-        *
-        * @var integer
-        */
-       $wgGATPInterval = 30;
-
-       /**
-        * To protect the API against anonymous calls, you can set this to 
true. You will need to
-        * transmit $wgSecretKey in your request to authenticate the call als 
valid.
-        *
-        * @var boolean
-        */
-       $wgGATPProtectAPI = true;
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'GoogleAnalyticsTopPages' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['GoogleAnalyticsTopPages'] = __DIR__ . '/i18n';
+       /* wfWarn(
+               'Deprecated PHP entry point used for GoogleAnalyticsTopPages 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       ); */
+       return true;
+} else {
+       die( 'This version of the GoogleAnalyticsTopPages extension requires 
MediaWiki 1.25+' );
+}
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..e59c6c7
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,43 @@
+{
+       "name": "GoogleAnalyticsTopPages",
+       "version": "0.0.1",
+       "author": "Florian Schmidt",
+       "url": 
"https://www.mediawiki.org/wiki/Extension:GoogleAnalyticsTopPages";,
+       "descriptionmsg": "googleanalyticstoppages-desc",
+       "license-name": "MIT",
+       "type": "parserhook",
+       "SpecialPages": {
+               "GoogleAnalyticsTopPages": "SpecialGoogleAnalyticsTopPages"
+       },
+       "APIModules": {
+               "googlepagestatsupdate": "ApiGooglePageStatsUpdate"
+       },
+       "MessagesDirs": {
+               "GoogleAnalyticsTopPages": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "GoogleAnalyticsTopPages": 
"includes/GoogleAnalyticsTopPages.body.php",
+               "GoogleAnalyticsTopPagesHooks": 
"includes/GoogleAnalyticsTopPages.hooks.php",
+               "SpecialGoogleAnalyticsTopPages": 
"includes/specials/SpecialGoogleAnalyticsTopPages.php",
+               "ApiGooglePageStatsUpdate": 
"includes/api/ApiGooglePageStatsUpdate.php"
+       },
+       "Hooks": {
+               "LoadExtensionSchemaUpdates": [
+                       
"GoogleAnalyticsTopPagesHooks::onLoadExtensionSchemaUpdates"
+               ],
+               "ParserFirstCallInit": [
+                       "GoogleAnalyticsTopPagesHooks::onParserFirstCallInit"
+               ]
+       },
+       "config": {
+               "GATPServiceAccountName": "",
+               "GATPKeyFileLocation": "",
+               "GATPAppName": "googleanalyticstoppages",
+               "GATPProfileId": "",
+               "GATPInterval": 30,
+               "GATPProtectAPI": true
+       },
+       "manifest_version": 1
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0be1f29a0316ff8b462112b58092dd5429cc1464
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GoogleAnalyticsTopPages
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

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

Reply via email to