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

Change subject: Upgrade Extension:OATHAuth to the registration system
......................................................................


Upgrade Extension:OATHAuth to the registration system

Bug: T87949
Change-Id: Id6217249c11922ab7d25b31375789c40d737600c
---
D OATHAuth.i18n.php
M OATHAuth.php
A extension.json
3 files changed, 79 insertions(+), 94 deletions(-)

Approvals:
  Paladox: Looks good to me, but someone else must approve
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/OATHAuth.i18n.php b/OATHAuth.i18n.php
deleted file mode 100644
index a78d608..0000000
--- a/OATHAuth.i18n.php
+++ /dev/null
@@ -1,36 +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( 'wfJsonI18nShim886e5f0000466d60' ) ) {
-       /** @noinspection PhpMissingDocCommentInspection */
-       function wfJsonI18nShim886e5f0000466d60( $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'][] = 
'wfJsonI18nShim886e5f0000466d60';
-}
diff --git a/OATHAuth.php b/OATHAuth.php
index b29911e..956628b 100644
--- a/OATHAuth.php
+++ b/OATHAuth.php
@@ -12,64 +12,18 @@
  * @license GNU General Public Licence 2.0 or later
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       echo "This file is an extension to the MediaWiki software and cannot be 
used standalone.\n";
-       die( 1 );
-}
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'OATHAuth' );
 
-$wgExtensionCredits['other'][] = array(
-       'path' => __FILE__,
-       'name' => 'OATHAuth',
-       'author' => 'Ryan Lane',
-       'version' => '0.2.1',
-       'url' => 'http://mediawiki.org/wiki/Extension:OATHAuth',
-       'descriptionmsg' => 'oathauth-desc',
-);
+       $wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['OATHAuthAlias'] = __DIR__ . 
'OATHAuth.alias.php';
 
-/**
- * The number of token windows in each direction that should be valid
- *
- * This tells OATH to accept tokens for a range of $wgOATHAuthWindowRadius * 2 
windows
- * (which is effectively ((1 + 2 * $wgOATHAuthWindowRadius) * 30) seconds).
- * This range of valid windows is centered around the current time.
- *
- * The purpose of this configuration variable is to account for differences 
between
- * the user's clock and the server's clock. However, it is recommended to keep 
it as
- * low as possible.
- *
- * @var int
- */
-$wgOATHAuthWindowRadius = 4;
+       /* wfWarn(
+               'Deprecated PHP entry point used for OATHAuth extension. Please 
use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       ); */
 
-$dir = __DIR__ . '/';
-
-$wgMessagesDirs['OATHAuth'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['OATHAuth'] = $dir . 'OATHAuth.i18n.php';
-$wgExtensionMessagesFiles['OATHAuthAlias'] = $dir . 'OATHAuth.alias.php';
-$wgAutoloadClasses['OATHAuthHooks'] = $dir . 'OATHAuth.hooks.php';
-$wgAutoloadClasses['HOTP'] = $dir . 'lib/hotp.php';
-$wgAutoloadClasses['HOTPResult'] = $dir . 'lib/hotp.php';
-$wgAutoloadClasses['Base32'] = $dir . 'lib/base32.php';
-$wgAutoloadClasses['OATHUser'] = $dir . 'OATHUser.php';
-$wgAutoloadClasses['SpecialOATH'] = $dir . 'special/SpecialOATH.php';
-$wgSpecialPages['OATH'] = 'SpecialOATH';
-
-$wgResourceModules['ext.oathauth'] = array(
-       'scripts' => array(
-               'modules/jquery.qrcode.js',
-               'modules/qrcode.js',
-       ),
-       'position' => 'top',
-       'localBasePath' => dirname( __FILE__ ),
-       'remoteExtPath' => 'OATHAuth',
-);
-
-$wgHooks['AbortChangePassword'][] = 'OATHAuthHooks::AbortChangePassword';
-$wgHooks['AbortLogin'][] = 'OATHAuthHooks::AbortLogin';
-$wgHooks['UserLoginForm'][] = 'OATHAuthHooks::ModifyUITemplate';
-$wgHooks['ChangePasswordForm'][] = 'OATHAuthHooks::ChangePasswordForm';
-$wgHooks['TwoFactorIsEnabled'][] = 'OATHAuthHooks::TwoFactorIsEnabled';
-$wgHooks['LoadExtensionSchemaUpdates'][] = 
'OATHAuthHooks::OATHAuthSchemaUpdates';
-$wgHooks['GetPreferences'][] = 'OATHAuthHooks::manageOATH';
-
-
+       return true;
+} else {
+       die( 'This version of the OATHAuth 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..78ed269
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,67 @@
+{
+       "name": "OATHAuth",
+       "version": "0.2.1",
+       "author": "Ryan Lane",
+       "url": "http://mediawiki.org/wiki/Extension:OATHAuth";,
+       "descriptionmsg": "oathauth-desc",
+       "type": "other",
+       "AutoloadClasses": {
+               "OATHAuthHooks": "OATHAuth.hooks.php",
+               "HOTP": "lib/hotp.php",
+               "HOTPResult": "lib/hotp.php",
+               "Base32": "lib/base32.php",
+               "OATHUser": "OATHUser.php",
+               "SpecialOATH": "special/SpecialOATH.php"
+       },
+       "ExtensionMessagesFiles": {
+               "OATHAuthAlias": "OATHAuth.alias.php"
+       },
+       "Hooks": {
+               "AbortChangePassword": [
+                       "OATHAuthHooks::AbortChangePassword"
+               ],
+               "AbortLogin": [
+                       "OATHAuthHooks::AbortLogin"
+               ],
+               "UserLoginForm": [
+                       "OATHAuthHooks::ModifyUITemplate"
+               ],
+               "ChangePasswordForm": [
+                       "OATHAuthHooks::ChangePasswordForm"
+               ],
+               "TwoFactorIsEnabled": [
+                       "OATHAuthHooks::TwoFactorIsEnabled"
+               ],
+               "LoadExtensionSchemaUpdates": [
+                       "OATHAuthHooks::OATHAuthSchemaUpdates"
+               ],
+               "GetPreferences": [
+                       "OATHAuthHooks::manageOATH"
+               ]
+       },
+       "MessagesDirs": {
+               "OATHAuth": [
+                       "i18n"
+               ]
+       },
+       "config": {
+               "OATHAuthWindowRadius": 4
+       },
+       "ResourceModules": {
+               "ext.oathauth": {
+                       "scripts": [
+                               "modules/jquery.qrcode.js",
+                               "modules/qrcode.js"
+                       ],
+                       "position": "top"
+               }
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "",
+               "remoteExtPath": "OATHAuth"
+       },
+       "SpecialPages": {
+               "OATH": "SpecialOATH"
+       },
+       "manifest_version": 1
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id6217249c11922ab7d25b31375789c40d737600c
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/OATHAuth
Gerrit-Branch: master
Gerrit-Owner: Victorbarbu <[email protected]>
Gerrit-Reviewer: Aklapper <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to