Mhutti1 has uploaded a new change for review. https://gerrit.wikimedia.org/r/258706
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. Bug: T87939 Change-Id: I5db8a77ec61076b02a5ecbcc8ee950a076bc057c --- D MapSources.i18n.php M MapSources.php A extension.json 3 files changed, 50 insertions(+), 74 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MapSources refs/changes/06/258706/1 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..06599bc 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 +} -- To view, visit https://gerrit.wikimedia.org/r/258706 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5db8a77ec61076b02a5ecbcc8ee950a076bc057c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MapSources Gerrit-Branch: master Gerrit-Owner: Mhutti1 <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
