jenkins-bot has submitted this change and it was merged. Change subject: Convert InputBox.php to extension.json for extension registration ......................................................................
Convert InputBox.php to extension.json for extension registration Bug: T87931 Change-Id: Ib3cd4714c842ebf17da5b1f0932fd886dbc65c66 --- D InputBox.i18n.php M InputBox.php A extension.json 3 files changed, 65 insertions(+), 104 deletions(-) Approvals: Legoktm: Looks good to me, approved Florianschmidtwelzow: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/InputBox.i18n.php b/InputBox.i18n.php deleted file mode 100644 index 73bf23c..0000000 --- a/InputBox.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( 'wfJsonI18nShim5f0a0d9bac62c1be' ) ) { - function wfJsonI18nShim5f0a0d9bac62c1be( $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'][] = 'wfJsonI18nShim5f0a0d9bac62c1be'; -} diff --git a/InputBox.php b/InputBox.php index d44f025..3f8b9eb 100644 --- a/InputBox.php +++ b/InputBox.php @@ -1,71 +1,13 @@ <?php -/** - * InputBox extension - * - * @file - * @ingroup Extensions - * - * This file contains the main include file for the Inputbox extension of - * MediaWiki. - * - * Usage: Add the following line in LocalSettings.php: - * require_once( "$IP/extensions/InputBox/InputBox.php" ); - * - * @author Erik Moeller <moel...@scireview.de> - * namespaces search improvements partially by - * Leonardo Pimenta <leo....@gmail.com> - * Cleaned up by Trevor Parscal <tpars...@wikimedia.org> - * @copyright Public domain - * @license Public domain - * @version 0.1.4 - */ - -// Check environment -if ( !defined( 'MEDIAWIKI' ) ) { - echo "This is an extension to the MediaWiki package and cannot be run standalone.\n"; - die( -1 ); +if ( function_exists( 'wfLoadExtension' ) ) { + wfLoadExtension( 'InputBox' ); + // Keep i18n globals so mergeMessageFileList.php doesn't break + $wgMessagesDirs['InputBox'] = __DIR__ . '/i18n'; + /* wfWarn( + 'Deprecated PHP entry point used for InputBox extension. Please use wfLoadExtension instead, ' . + 'see https://www.mediawiki.org/wiki/Extension_registration for more details.' + ); */ + return; +} else { + die( 'This version of the InputBox extension requires MediaWiki 1.25+' ); } - -// Credits -$wgExtensionCredits['parserhook'][] = array( - 'path' => __FILE__, - 'name' => 'InputBox', - 'author' => array( 'Erik Moeller', 'Leonardo Pimenta', 'Rob Church', 'Trevor Parscal', 'DaSch' ), - 'version' => '0.3.0', - 'url' => 'https://www.mediawiki.org/wiki/Extension:InputBox', - 'description' => 'Allow inclusion of predefined HTML forms.', - 'descriptionmsg' => 'inputbox-desc', -); - -// Internationalization -$wgMessagesDirs['InputBox'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['InputBox'] = __DIR__ . '/InputBox.i18n.php'; - -// Register auto load for the special page class -$wgAutoloadClasses['InputBoxHooks'] = __DIR__ . '/InputBox.hooks.php'; -$wgAutoloadClasses['InputBox'] = __DIR__ . '/InputBox.classes.php'; - -// Register parser hook -$wgHooks['ParserFirstCallInit'][] = 'InputBoxHooks::register'; -$wgHooks['MediaWikiPerformAction'][] = 'InputBoxHooks::onMediaWikiPerformAction'; -$wgHooks['SpecialPageBeforeExecute'][] = 'InputBoxHooks::onSpecialPageBeforeExecute'; - -$resourcePaths = array( - 'localBasePath' => __DIR__ . '/resources', - 'remoteExtPath' => 'InputBox/resources' -); - -$wgResourceModules['ext.inputBox.styles'] = $resourcePaths + array( - 'position' => 'top', - 'styles' => 'ext.inputBox.styles.css', - 'targets' => array( 'mobile', 'desktop' ), -); - -$wgResourceModules['ext.inputBox'] = $resourcePaths + array( - 'scripts' => 'ext.inputBox.js', - 'dependencies' => array( - 'jquery.throttle-debounce' - ) -); - -unset( $resourcePaths ); diff --git a/extension.json b/extension.json new file mode 100644 index 0000000..3027e89 --- /dev/null +++ b/extension.json @@ -0,0 +1,54 @@ +{ + "name": "InputBox", + "version": "0.3.0", + "author": [ + "Erik Moeller", + "Leonardo Pimenta", + "Rob Church", + "Trevor Parscal", + "DaSch" + ], + "url": "https://www.mediawiki.org/wiki/Extension:InputBox", + "description": "Allow inclusion of predefined HTML forms.", + "descriptionmsg": "inputbox-desc", + "type": "parserhook", + "MessagesDirs": { + "InputBox": [ + "i18n" + ] + }, + "AutoloadClasses": { + "InputBoxHooks": "InputBox.hooks.php", + "InputBox": "InputBox.classes.php" + }, + "ResourceModules": { + "ext.inputBox.styles": { + "styles": "ext.inputBox.styles.css" + }, + "ext.inputBox": { + "scripts": "ext.inputBox.js", + "dependencies": [ + "jquery.throttle-debounce" + ], + "targets": [ + "mobile", + "desktop" + ] + } + }, + "ResourceFileModulePaths": { + "localBasePath": "resources", + "remoteExtPath": "InputBox/resources" + }, + "Hooks": { + "ParserFirstCallInit": [ + "InputBoxHooks::register" + ], + "MediaWikiPerformAction": [ + "InputBoxHooks::onMediaWikiPerformAction" + ], + "SpecialPageBeforeExecute": [ + "InputBoxHooks::onSpecialPageBeforeExecute" + ] + } +} -- To view, visit https://gerrit.wikimedia.org/r/206615 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib3cd4714c842ebf17da5b1f0932fd886dbc65c66 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/InputBox Gerrit-Branch: master Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de> Gerrit-Reviewer: Jackmcbarn <jackmcb...@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits