Kghbln has submitted this change and it was merged.

Change subject: Convert extension to Extension Registration
......................................................................


Convert extension to Extension Registration

Change-Id: If0044ed0673d7434f35126dcb012c76c1f9d8175
---
M CHANGELOG
D MinimumNameLength.i18n.php
M MinimumNameLength.php
A extension.json
4 files changed, 43 insertions(+), 67 deletions(-)

Approvals:
  MtDu: Looks good to me, but someone else must approve
  Kghbln: Verified; Looks good to me, approved



diff --git a/CHANGELOG b/CHANGELOG
index 0702ad9..a1edc27 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
 The CHANGELOG of the Minimum Name Length extension to MediaWiki.
 
+== Version 1.3.0 ==
+* [BREAKING CHANGE] Converted the extension to use extension registration, 
instead of PHP entry point.
+  This breaks compatibility with MediaWiki versions older than 1.25.0.
 
 == Version 1.2.2 ==
 
diff --git a/MinimumNameLength.i18n.php b/MinimumNameLength.i18n.php
deleted file mode 100644
index 03599f9..0000000
--- a/MinimumNameLength.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( 'wfJsonI18nShimMinimumNameLenght' ) ) {
-   function wfJsonI18nShimMinimumNameLenght( $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'][] = 
'wfJsonI18nShimMinimumNameLenght';
-}
diff --git a/MinimumNameLength.php b/MinimumNameLength.php
index b16d86d..709a7d8 100644
--- a/MinimumNameLength.php
+++ b/MinimumNameLength.php
@@ -16,36 +16,16 @@
  *
  * @license http://www.opensource.org/licenses/BSD-2-Clause BSD 2-clause
  */
-
-// Ensure that the script cannot be executed outside of MediaWiki
-if ( !defined( 'MEDIAWIKI' ) ) {
-    die( 'This is an extension to MediaWiki and cannot be run standalone.' );
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'MinimumNameLength' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['MinimumNameLength'] = __DIR__ . '/i18n';
+       /* wfWarn(
+               'Deprecated PHP entry point used for Minimum Username Length 
extension. ' .
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       ); */
+       return true;
+} else {
+       die( 'This version of the Minimum Username Length extension requires 
MediaWiki 1.25+' );
 }
-
-// Display extension's information on "Special:Version"
-$wgExtensionCredits['other'][] = array(
-       'path' => '__FILE__',
-       'name' => 'Minimum Username Length',
-       'version' => '1.2.2',
-       'author' => array(
-               'Rob Church',
-               'Karsten Hoffmeyer',
-               '...'
-               ),
-       'descriptionmsg' => 'minimumnamelength-desc',
-       'url' => 'https://www.mediawiki.org/wiki/Extension:Minimum_Name_Length',
-       'license-name' => 'BSD-2-Clause'
-);
-
-// Minimum username length to enforce
-$wgMinimumUsernameLength = 10;
-
-// Load exension's class
-$wgAutoloadClasses['MinimumNameLength'] = __DIR__ . 
'/MinimumNameLength.class.php';
-
-// Register extension messages
-$wgMessagesDirs['MinimumNameLength'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['MinimumNameLength'] = __DIR__ . 
'/MinimumNameLength.i18n.php';
-
-// Register hooks
-$wgHooks['AbortNewAccount'][] = 'MinimumNameLength::onAbortNewAccount';
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..9c56fe6
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,28 @@
+{
+       "name": "Minimum Username Length",
+       "version": "1.3.0",
+       "author": [
+               "Rob Church",
+               "Karsten Hoffmeyer",
+               "..."
+       ],
+       "url": "https://www.mediawiki.org/wiki/Extension:Minimum_Name_Length";,
+       "descriptionmsg": "minimumnamelength-desc",
+       "license-name": "BSD-2-Clause",
+       "type": "other",
+       "MessagesDirs": {
+               "MinimumNameLength": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "MinimumNameLength": "MinimumNameLength.class.php"
+       },
+       "Hooks": {
+               "AbortNewAccount": "MinimumNameLength::onAbortNewAccount"
+       },
+       "config": {
+               "MinimumUsernameLength": 10
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If0044ed0673d7434f35126dcb012c76c1f9d8175
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MinimumNameLength
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Kghbln <kars...@hoffmeyer.info>
Gerrit-Reviewer: MtDu <justin.d...@gmail.com>

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

Reply via email to