Jayprakash12345 has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405592 )

Change subject: Convert AzharAuth to use extension registration
......................................................................

Convert AzharAuth to use extension registration

Bug: T185416
Change-Id: Ifd32a7a47bfc51d7d4ef585183ded9b8fffbd386
---
D AzharAuth.options.php
M AzharAuth.php
A extension.json
3 files changed, 74 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AzharAuth 
refs/changes/92/405592/1

diff --git a/AzharAuth.options.php b/AzharAuth.options.php
deleted file mode 100644
index d451f53..0000000
--- a/AzharAuth.options.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
-
-/**
- * MediaWiki Authentication Plugin for Azhàr
- * Options
- *
- * @author      Sébastien Santoro aka Dereckson <dereck...@espace-win.org>
- * @license     http://www.opensource.org/licenses/gpl-2.0.php GPLv2
- * @link        http://keruald.sf.net/azhar
- * @link        http://www.mediawiki.org/wiki/Extension:Azhàr_Authentication
- * @file
- * @ingroup     Extensions
- */
-
-/**
- * @var boolean Determines if a link to the Azhàr intranet homepage should be 
added.
- */
-$wgAzharAuthAddGoToIntranetLink = true;
-
-/**
- * @var boolean If true, only allows authentication through Azhàr and disables 
regular login/logout. Otherwise, Azhàr is an extra option to login.
- */
-$wgAzharAuthOnlyLoginSource = true;
-
-/**
- * @var boolean If true, creates a new account if the user doesn't exist in 
the database.
- */
-$wgAzharAllowCreateAccounts = false;
-
-/**
- * @var array, each row a string for a parameter to match. The fields to use 
to match user between the Azhàr sign in and provisioning document, and the 
local user database. Valid values: username, email.
- */
-$wgAzharMatchAccountBy = array(
-   'email'
-);
-
-/**
- * @var string The Azhàr login URL
- */
-$wgAzharLoginUrl = '';
-
-/**
- * @var string The Azhàr main intranet URL
- */
-$wgAzharMainUrl = '';
-
-/**
- * @var string The Azhàr product name. If omitted, 
[[MediaWiki:defaultproductname]] is used.
- */
-$wgAzharProductName = '';
-
-/**
- * @var string The Azhàr single sign on and provisioning API consumer key
- *
- * The purpose of this key is to identify this sitef, like a login.
- */
-$wgAzharConsumerKey = '';
-
-/**
- * @var string The Azhàr single sign on and provisioning API secret key
- *
- * The purpose of this key is to be a shared secret shared between Azhàr and 
this site, to ensure the information exchanged are legit.
- */
-$wgAzharSecretKey = '';
diff --git a/AzharAuth.php b/AzharAuth.php
index 7e9f2fd..a395bca 100644
--- a/AzharAuth.php
+++ b/AzharAuth.php
@@ -11,41 +11,17 @@
  * @ingroup Extensions
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-   echo( "This file is an extension to the MediaWiki software and is not 
intended to be used standalone.\n" );
-   die( 1 );
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'AzharAuth' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['AzharAuth'] = __DIR__ . '/i18n';
+       wfWarn(
+               'Deprecated PHP entry point used for the AzharAuth extension. ' 
.
+               'Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the AzharAuth extension requires MediaWiki 1.29+' 
);
 }
 
-///
-/// Extension metadata
-///
-
-$wgExtensionCredits['other'][] = array(
-       'path' => __FILE__,
-       'name' => 'Azhàr Authentication',
-       'version' => '1.2.0',
-       'author' => "Sébastien Santoro aka Dereckson",
-       'url' => 
"https://www.mediawiki.org/wiki/Extension:Azhàr_Authentication";,
-       'descriptionmsg' => "azharauth-desc",
-);
-
-///
-/// Extension initialization
-///
-
-require( 'AzharAuth.options.php' );
-
-$dir = __DIR__ . '/';
-
-$wgAutoloadClasses['AzharAuth'] = $dir . 'AzharAuth.class.php';
-$wgAutoloadClasses['AzharAuthHooks'] = $dir . 'AzharAuthHooks.php';
-$wgAutoloadClasses['SpecialAzharAuth'] = $dir . 'SpecialAzharAuth.php';
-
-$wgMessagesDirs['AzharAuth'] = $dir . 'i18n';
-$wgExtensionMessagesFiles['AzharAuthAlias'] = $dir . 'AzharAuth.alias.php';
-
-$wgHooks['PersonalUrls'][] = 'AzharAuthHooks::editPersonalLinks';
-$wgHooks['SpecialPage_initList'][] = 'AzharAuthHooks::disableSpecialPages';
-$wgHooks['UserLogoutComplete'][] = 'AzharAuthHooks::onUserLogoutComplete';
-
-$wgSpecialPages['AzharAuth'] = 'SpecialAzharAuth';
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..4333e5c
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,62 @@
+{
+       "name": "Azhàr Authentication",
+       "version": "1.2.0",
+       "author": "Sébastien Santoro aka Dereckson",
+       "url": 
"https://www.mediawiki.org/wiki/Extension:Azh%C3%A0r_Authentication";,
+       "descriptionmsg": "azharauth-desc",
+       "license-name": "GPL-2.0",
+       "type": "other",
+       "SpecialPages": {
+               "AzharAuth": "SpecialAzharAuth"
+       },
+       "MessagesDirs": {
+               "AzharAuth": [
+                       "i18n"
+               ]
+       },
+       "ExtensionMessagesFiles": {
+               "AzharAuthAlias": "AzharAuth.alias.php"
+       },
+       "AutoloadClasses": {
+               "AzharAuth": "AzharAuth.class.php",
+               "AzharAuthHooks": "AzharAuthHooks.php",
+               "SpecialAzharAuth": "SpecialAzharAuth.php"
+       },
+       "Hooks": {
+               "PersonalUrls": "AzharAuthHooks::editPersonalLinks",
+               "SpecialPage_initList": "AzharAuthHooks::disableSpecialPages",
+               "UserLogoutComplete": "AzharAuthHooks::onUserLogoutComplete"
+       },
+       "config": {
+               "AzharAuthAddGoToIntranetLink": {
+                       "value": true
+               },
+               "AzharAuthOnlyLoginSource": {
+                       "value": true
+               },
+               "AzharAllowCreateAccounts": {
+                       "value": false
+               },
+               "AzharMatchAccountBy": {
+                       "value": [
+                               "email"
+                       ]
+               },
+               "AzharLoginUrl": {
+                       "value": ""
+               },
+               "AzharMainUrl": {
+                       "value": ""
+               },
+               "AzharProductName": {
+                       "value": ""
+               },
+               "AzharConsumerKey": {
+                       "value": ""
+               },
+               "AzharSecretKey": {
+                       "value": ""
+               }
+       },
+       "manifest_version": 2
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifd32a7a47bfc51d7d4ef585183ded9b8fffbd386
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AzharAuth
Gerrit-Branch: master
Gerrit-Owner: Jayprakash12345 <0freerunn...@gmail.com>

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

Reply via email to