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

Change subject: Converted MapSources to new extension registration system
......................................................................


Converted MapSources to new extension registration system

Moved most of MapSources.php to the new extension.json
and added method for backward compatable implementation
of the extension.

The credits for MapSourcesMath are not carried over, and the
description message was removed.

Bug: T87939
Change-Id: I5db8a77ec61076b02a5ecbcc8ee950a076bc057c
---
D MapSources.i18n.php
M MapSources.php
A extension.json
M i18n/en.json
M i18n/qqq.json
5 files changed, 52 insertions(+), 78 deletions(-)

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



diff --git a/MapSources.i18n.php b/MapSources.i18n.php
deleted file mode 100644
index fc2fbe9..0000000
--- a/MapSources.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * This is a backwards-compatibility shim, generated by:
- * 
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/HEAD/maintenance%2FgenerateJsonI18n.php
- *
- * Beginning with MediaWiki 1.23, translation strings are stored in json files,
- * and the EXTENSION.i18n.php file only exists to provide compatibility with
- * older releases of MediaWiki. For more information about this migration, see:
- * https://www.mediawiki.org/wiki/Requests_for_comment/Localisation_format
- *
- * This shim maintains compatibility back to MediaWiki 1.17.
- */
-$messages = array();
-if ( !function_exists( 'wfJsonI18nShim092b743d4978dfd0' ) ) {
-       function wfJsonI18nShim092b743d4978dfd0( $cache, $code, &$cachedData ) {
-               $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-               foreach ( $codeSequence as $csCode ) {
-                       $fileName = dirname( __FILE__ ) . "/i18n/$csCode.json";
-                       if ( is_readable( $fileName ) ) {
-                               $data = FormatJson::decode( file_get_contents( 
$fileName ), true );
-                               foreach ( array_keys( $data ) as $key ) {
-                                       if ( $key === '' || $key[0] === '@' ) {
-                                               unset( $data[$key] );
-                                       }
-                               }
-                               $cachedData['messages'] = array_merge( $data, 
$cachedData['messages'] );
-                       }
-
-                       $cachedData['deps'][] = new FileDependency( $fileName );
-               }
-               return true;
-       }
-
-       $GLOBALS['wgHooks']['LocalisationCacheRecache'][] = 
'wfJsonI18nShim092b743d4978dfd0';
-}
diff --git a/MapSources.php b/MapSources.php
index a3fac9b..4466764 100644
--- a/MapSources.php
+++ b/MapSources.php
@@ -11,42 +11,17 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 
2.0 or later
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'This file is a MediaWiki extension, it is not a valid entry 
point' );
-}
-
-// autoloader
-$wgAutoloadClasses['MapSourcesHooks'] = __DIR__ . '/MapSources.hooks.php';
-$wgAutoloadClasses['MapSourcesPage'] = __DIR__ . '/MapSources_body.php';
-$wgAutoloadClasses['MapSourcesMath'] = __DIR__ . '/MapSources_math.php';
-$wgAutoloadClasses['MapSourcesTransform'] = __DIR__ . 
'/MapSources_transform.php';
-
-// special page
-$wgSpecialPages['MapSources'] = 'MapSourcesPage';
-
-// parser hooks
-$wgHooks['ParserFirstCallInit'][] = 'MapSourcesHooks::parserHooks';
-
-// extension & magic words i18n
-$wgMessagesDirs['MapSources'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['MapSources'] = __DIR__ . '/MapSources.i18n.php';
-$wgExtensionMessagesFiles['MapSourcesMagic'] = __DIR__ . 
'/MapSources.i18n.magic.php';
-$wgExtensionMessagesFiles['MapSourcesAlias'] = __DIR__ . 
'/MapSources.i18n.alias.php';
-
-// credits
-$wgExtensionCredits['specialpage'][] = array(
-       'path' => __FILE__,
-       'name' => 'MapSources',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:MapSources',
-       'descriptionmsg' => 'mapsources-desc',
-       'author' => array( 'Roland Unger', 'Egil Kvaleberg', 'Matthias Mullie' 
),
-       'version' => '1.8.0'
-);
-$wgExtensionCredits['parserhook'][] = array(
-       'path' => __FILE__,
-       'name' => 'MapSourcesMath',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:MapSources',
-       'descriptionmsg' => 'mapsources-math-desc',
-       'author' => array( 'Roland Unger', 'Matthias Mullie' ),
-       'version' => '1.07'
-);
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'MapSources' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['MapSources'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['MapSourcesAlias'] = __DIR__ . 
'/MapSources.i18n.alias.php';
+       $wgExtensionMessagesFiles['MapSourcesMagic'] = __DIR__ . 
'/MapSources.i18n.magic.php';
+       /*wfWarn(
+               'Deprecated PHP entry point used for MapSources extension. 
Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );*/
+       return;
+} else {
+       die( 'This version of the MapSources 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..8734efb
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,36 @@
+{
+       "name": "MapSources",
+       "version": "1.8.0",
+       "author": [
+               "Roland Unger",
+               "Egil Kvaleberg",
+               "Matthias Mullie"
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:MapSources";,
+       "descriptionmsg": "mapsources-desc",
+       "type": "specialpage",
+       "SpecialPages": {
+               "MapSources": "MapSourcesPage"
+       },
+       "MessagesDirs": {
+               "MapSources": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "MapSourcesMagic": "MapSources.i18n.magic.php",
+               "MapSourcesAlias": "MapSources.i18n.alias.php"
+       },
+       "AutoloadClasses": {
+               "MapSourcesHooks": "MapSources.hooks.php",
+               "MapSourcesPage": "MapSources_body.php",
+               "MapSourcesMath": "MapSources_math.php",
+               "MapSourcesTransform": "MapSources_transform.php"
+       },
+       "Hooks": {
+               "ParserFirstCallInit": [
+                       "MapSourcesHooks::parserHooks"
+               ]
+       },
+       "manifest_version": 1
+}
diff --git a/i18n/en.json b/i18n/en.json
index eb28311..adad178 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -16,6 +16,5 @@
        "mapsources-outofrange": "Coordinate out of range",
        "mapsources-math-missing-operand": "Missing operand",
        "mapsources-math-incorrect-input": "Incorrect input",
-       "mapsources-desc": "[[Special:MapSources|Search]] data and maps in 
resources",
-       "mapsources-math-desc": "Adds tags for conversion of coordinates"
+       "mapsources-desc": "[[Special:MapSources|Search]] data and maps in 
resources"
 }
\ No newline at end of file
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 7c680ba..c1ad3ba 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -21,6 +21,5 @@
        "mapsources-outofrange": "Error message when coordinates are out of 
range.",
        "mapsources-math-missing-operand": "Error message when operand is 
missing.",
        "mapsources-math-incorrect-input": "Error message when input is 
incorrect",
-       "mapsources-desc": "{{desc|name=Map 
Sources|url=https://www.mediawiki.org/wiki/Extension:MapSources}}\nExtension 
credits: special page description.  See [[Thread:Support/About 
MediaWiki:Mapsources-desc/cy|discussion]] of precise meaning.",
-       "mapsources-math-desc": "Extension credits: parser hook description"
+       "mapsources-desc": "{{desc|name=Map 
Sources|url=https://www.mediawiki.org/wiki/Extension:MapSources}}\nExtension 
credits: special page description.  See [[Thread:Support/About 
MediaWiki:Mapsources-desc/cy|discussion]] of precise meaning."
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5db8a77ec61076b02a5ecbcc8ee950a076bc057c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/MapSources
Gerrit-Branch: master
Gerrit-Owner: Mhutti1 <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to