Paladox has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247572

Change subject: Add extension.json, empty php entry point
......................................................................

Add extension.json, empty php entry point

Change-Id: Ic645e5ddd36bfb25149c832d3836d3b11683cc09
---
M .gitignore
D WebPlatformAuth.i18n.php
M WebPlatformAuth.php
M composer.json
M composer.lock
A extension.json
M includes/FirefoxAccountsManager.php
M includes/WebPlatformAuthHooks.php
M includes/WebPlatformAuthUserFactory.php
D vendor/.gitkeep
10 files changed, 141 insertions(+), 173 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WebPlatformAuth 
refs/changes/72/247572/1

diff --git a/.gitignore b/.gitignore
index 26a012b..98b092a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,3 @@
 *~
 *.kate-swp
 .*.swp
-vendor/*
diff --git a/WebPlatformAuth.i18n.php b/WebPlatformAuth.i18n.php
deleted file mode 100644
index 2e5013e..0000000
--- a/WebPlatformAuth.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( 'wfJsonI18nShim56c5f860fb1c5353' ) ) {
-       function wfJsonI18nShim56c5f860fb1c5353( $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'][] = 
'wfJsonI18nShim56c5f860fb1c5353';
-}
diff --git a/WebPlatformAuth.php b/WebPlatformAuth.php
index 3c8033b..2976bbb 100644
--- a/WebPlatformAuth.php
+++ b/WebPlatformAuth.php
@@ -11,49 +11,15 @@
  * @version 2.0-dev
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-  echo( "Not an entry point." );
-  die( -1 );
-}
-
-//if ( version_compare( $GLOBALS['wgVersion'], '1.22', '<' ) ) {
-//   die( '<b>Error:</b> This extension requires MediaWiki 1.22 or above' );
-//}
-
-$dir = dirname(__FILE__) . '/';
-
-if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) {
-  $loader = require( __DIR__ . '/vendor/autoload.php' );
-  $loader->add( 'Guzzle\\', $dir . '/vendor/guzzlehttp/guzzle/src/Guzzle/' );
+if ( function_exists( 'wfLoadExtension' ) ) {
+       wfLoadExtension( 'WebPlatformAuth' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['WebPlatformAuth'] = __DIR__ . '/i18n';
+       /* wfWarn(
+               'Deprecated PHP entry point used for WebPlatformAuth extension. 
Please use wfLoadExtension instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       ); */
+       return;
 } else {
-  die('You MUST install Composer dependencies');
+       die( 'This version of the WebPlatformAuth extension requires MediaWiki 
1.25+' );
 }
-
-$wgExtensionCredits['other'][] = array(
-  'name'           => 'WebPlatformAuth',
-  'path'           => __FILE__,
-  'version'        => '2.0-dev',
-  'author'         => array('[https://renoirboulanger.com Renoir Boulanger]'),
-  'url'            => 
'http://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension',
-  'description'    => 'Single Sign On MediaWiki extension',
-);
-
-$wgAutoloadClasses['WebPlatformAuthHooks']       = $dir . 
'includes/WebPlatformAuthHooks.php';
-
-$wgAutoloadClasses['AccountsHandlerSpecialPage'] = $dir . 
'includes/specials/AccountsHandlerSpecialPage.php';
-$wgAutoloadClasses['WebPlatformAuthLogin']       = $dir . 
'includes/specials/WebPlatformAuthLogin.php';
-$wgAutoloadClasses['WebPlatformAuthLogout']      = $dir . 
'includes/specials/WebPlatformAuthLogout.php';
-$wgAutoloadClasses['WebPlatformAuthPassword']    = $dir . 
'includes/specials/WebPlatformAuthPassword.php';
-
-$wgMessagesDirs['WebPlatformAuth']           = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['WebPlatformAuth'] = $dir . 
'WebPlatformAuth.i18n.php';
-
-// Change AccountsHandler for better name later #TODO
-$wgSpecialPages['AccountsHandler'] = 'AccountsHandlerSpecialPage';
-$wgSpecialPages['Userlogin']       = 'WebPlatformAuthLogin';
-$wgSpecialPages['Userlogout']      = 'WebPlatformAuthLogout';
-$wgSpecialPages['ChangePassword']  = 'WebPlatformAuthPassword';
-
-$wgHooks['UserLoadFromSession'][]  = 
'WebPlatformAuthHooks::onUserLoadFromSession';
-$wgHooks['GetPreferences'][]       = 
'WebPlatformAuthHooks::hookLimitPreferences';
-$wgHooks['SpecialPage_initList'][] = 
'WebPlatformAuthHooks::hookInitSpecialPages';
\ No newline at end of file
diff --git a/composer.json b/composer.json
index b71dcf8..bf320a5 100644
--- a/composer.json
+++ b/composer.json
@@ -1,51 +1,54 @@
 {
-  "name": "webplatform/mediawiki-fxa-sso",
-  "type": "mediawiki-extension",
-  "license": "MIT",
-  "description": "WebPlatform Docs SSO Extension communicating with 
WebPlatorm’s own Firefox Accounts server",
-  "keywords": [
-    "MediaWiki",
-    "WebPlatform",
-    "authentication",
-    "Firefox Accounts",
-    "OAuth2",
-    "FxA"
-  ],
-  "homepage": 
"http://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension";,
-  "authors": [
-    {
-      "name": "Renoir Boulanger",
-      "email": "[email protected]",
-      "role": "Maintainer",
-      "homepage": "https://renoirboulanger.com";
-    },
-    {
-      "name": "Doug Schepers",
-      "email": "[email protected]",
-      "role": "Project lead"
-    }
-  ],
-  "support": {
-    "issues": "https://github.com/webplatform/mediawiki-fxa-sso/issues";,
-    "email":  "[email protected]",
-    "irc":    "irc://irc.freenode.net/webplatform",
-    "source": "https://github.com/webplatform/mediawiki-fxa-sso";
-  },
-  "require": {
-    "guzzlehttp/guzzle": "~3.8"
-  },
-  "autoload": {
-    "files" : [
-      "WebPlatformAuth.php"
-    ],
-    "classmap":[
-      "includes/"
-    ]
-  },
-  "repositories": [
-    {
-      "type": "vcs",
-      "url": "https://github.com/webplatform/mediawiki-fxa-sso";
-    }
-  ]
+       "name": "webplatform/mediawiki-fxa-sso",
+       "type": "mediawiki-extension",
+       "license": "MIT",
+       "description": "WebPlatform Docs SSO Extension communicating with 
WebPlatorm’s own Firefox Accounts server",
+       "keywords": [
+               "MediaWiki",
+               "WebPlatform",
+               "authentication",
+               "Firefox Accounts",
+               "OAuth2",
+               "FxA"
+       ],
+       "homepage": 
"http://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension";,
+       "authors": [
+               {
+                       "name": "Renoir Boulanger",
+                       "email": "[email protected]",
+                       "role": "Maintainer",
+                       "homepage": "https://renoirboulanger.com";
+               },
+               {
+                       "name": "Doug Schepers",
+                       "email": "[email protected]",
+                       "role": "Project lead"
+               }
+       ],
+       "support": {
+               "issues": 
"https://github.com/webplatform/mediawiki-fxa-sso/issues";,
+               "email":  "[email protected]",
+               "irc":    "irc://irc.freenode.net/webplatform",
+               "source": "https://github.com/webplatform/mediawiki-fxa-sso";
+       },
+       "require": {
+               "guzzlehttp/guzzle": "~3.8"
+       },
+       "autoload": {
+               "psr-4": {
+                       "Guzzle\\": "vendor/guzzlehttp/guzzle/src/Guzzle/"
+               },
+               "files" : [
+                       "WebPlatformAuth.php"
+               ],
+               "classmap":[
+                       "includes/"
+               ]
+       },
+       "repositories": [
+               {
+                       "type": "vcs",
+                       "url": 
"https://gerrit.wikimedia.org/r/mediawiki/extensions/WebPlatformAuth";
+               }
+       ]
 }
diff --git a/composer.lock b/composer.lock
index 4aba2e3..8805dac 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1,9 +1,11 @@
 {
     "_readme": [
         "This file locks the dependencies of your project to a known state",
-        "Read more about it at 
http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";
+        "Read more about it at 
https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
+        "This file is @generated automatically"
     ],
-    "hash": "c635d4c923295de15a39b2d5cc345712",
+    "hash": "156d8056217e65d4c26ea853728eaa82",
+    "content-hash": "4fb0e7969e54f7a88709bb7a7abe1f2c",
     "packages": [
         {
             "name": "guzzlehttp/guzzle",
@@ -99,27 +101,28 @@
         },
         {
             "name": "symfony/event-dispatcher",
-            "version": "v2.5.0",
-            "target-dir": "Symfony/Component/EventDispatcher",
+            "version": "v2.7.5",
             "source": {
                 "type": "git",
-                "url": "https://github.com/symfony/EventDispatcher.git";,
-                "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8"
+                "url": "https://github.com/symfony/event-dispatcher.git";,
+                "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/symfony/EventDispatcher/zipball/cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8";,
-                "reference": "cb62ec8dd05893fc8e4f0e6e21e326e1fc731fe8",
+                "url": 
"https://api.github.com/repos/symfony/event-dispatcher/zipball/ae4dcc2a8d3de98bd794167a3ccda1311597c5d9";,
+                "reference": "ae4dcc2a8d3de98bd794167a3ccda1311597c5d9",
                 "shasum": ""
             },
             "require": {
-                "php": ">=5.3.3"
+                "php": ">=5.3.9"
             },
             "require-dev": {
                 "psr/log": "~1.0",
-                "symfony/config": "~2.0",
-                "symfony/dependency-injection": "~2.0",
-                "symfony/stopwatch": "~2.2"
+                "symfony/config": "~2.0,>=2.0.5",
+                "symfony/dependency-injection": "~2.6",
+                "symfony/expression-language": "~2.6",
+                "symfony/phpunit-bridge": "~2.7",
+                "symfony/stopwatch": "~2.3"
             },
             "suggest": {
                 "symfony/dependency-injection": "",
@@ -128,11 +131,11 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.5-dev"
+                    "dev-master": "2.7-dev"
                 }
             },
             "autoload": {
-                "psr-0": {
+                "psr-4": {
                     "Symfony\\Component\\EventDispatcher\\": ""
                 }
             },
@@ -143,34 +146,24 @@
             "authors": [
                 {
                     "name": "Fabien Potencier",
-                    "email": "[email protected]",
-                    "homepage": "http://fabien.potencier.org";,
-                    "role": "Lead Developer"
+                    "email": "[email protected]"
                 },
                 {
                     "name": "Symfony Community",
-                    "homepage": "http://symfony.com/contributors";
+                    "homepage": "https://symfony.com/contributors";
                 }
             ],
             "description": "Symfony EventDispatcher Component",
-            "homepage": "http://symfony.com";,
-            "time": "2014-04-29 10:13:57"
+            "homepage": "https://symfony.com";,
+            "time": "2015-09-22 13:49:29"
         }
     ],
-    "packages-dev": [
-
-    ],
-    "aliases": [
-
-    ],
+    "packages-dev": [],
+    "aliases": [],
     "minimum-stability": "stable",
-    "stability-flags": [
-
-    ],
-    "platform": [
-
-    ],
-    "platform-dev": [
-
-    ]
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": [],
+    "platform-dev": []
 }
diff --git a/extension.json b/extension.json
new file mode 100644
index 0000000..b4bccf6
--- /dev/null
+++ b/extension.json
@@ -0,0 +1,43 @@
+{
+       "name": "WebPlatformAuth",
+       "version": "2.0-dev",
+       "author": [
+               "[https://renoirboulanger.com Renoir Boulanger]"
+       ],
+       "url": 
"http://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension";,
+       "description": "Single Sign On MediaWiki extension",
+       "type": "other",
+       "callback": "WebPlatformAuthHooks::onExtensionRegistration",
+       "SpecialPages": {
+               "AccountsHandler": "AccountsHandlerSpecialPage",
+               "Userlogin": "WebPlatformAuthLogin",
+               "Userlogout": "WebPlatformAuthLogout",
+               "ChangePassword": "WebPlatformAuthPassword"
+       },
+       "MessagesDirs": {
+               "WebPlatformAuth": [
+                       "i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "WebPlatformAuthUserFactory": 
"includes/WebPlatformAuthUserFactory.php",
+               "FirefoxAccountsManager": "includes/FirefoxAccountsManager.php",
+               "WebPlatformAuthHooks": "includes/WebPlatformAuthHooks.php",
+               "AccountsHandlerSpecialPage": 
"includes/specials/AccountsHandlerSpecialPage.php",
+               "WebPlatformAuthLogin": 
"includes/specials/WebPlatformAuthLogin.php",
+               "WebPlatformAuthLogout": 
"includes/specials/WebPlatformAuthLogout.php",
+               "WebPlatformAuthPassword": 
"includes/specials/WebPlatformAuthPassword.php"
+       },
+       "Hooks": {
+               "UserLoadFromSession": [
+                       "WebPlatformAuthHooks::onUserLoadFromSession"
+               ],
+               "GetPreferences": [
+                       "WebPlatformAuthHooks::hookLimitPreferences"
+               ],
+               "SpecialPage_initList": [
+                       "WebPlatformAuthHooks::hookInitSpecialPages"
+               ]
+       },
+       "manifest_version": 1
+}
diff --git a/includes/FirefoxAccountsManager.php 
b/includes/FirefoxAccountsManager.php
index b96eb8f..81ef271 100644
--- a/includes/FirefoxAccountsManager.php
+++ b/includes/FirefoxAccountsManager.php
@@ -13,8 +13,7 @@
 // Guzzle Exceptions
 use Guzzle\Http\Exception\ClientErrorResponseException;
 
-class FirefoxAccountsManager
-{
+class FirefoxAccountsManager {
 
   const NO_RESULT_YET     = 0;
 
diff --git a/includes/WebPlatformAuthHooks.php 
b/includes/WebPlatformAuthHooks.php
index dcec798..a1bac0f 100644
--- a/includes/WebPlatformAuthHooks.php
+++ b/includes/WebPlatformAuthHooks.php
@@ -7,15 +7,16 @@
  * https://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension
  **/
 
-// FIXME, Loader.. :(
-require_once( dirname( __FILE__ ) . '/WebPlatformAuthUserFactory.php' );
-require_once( dirname( __FILE__ ) . '/FirefoxAccountsManager.php' );
+// Guzzle classes
+use Guzzle\Http\Client;
 
 // Guzzle Exceptions
 use Guzzle\Http\Exception\ClientErrorResponseException;
 
-class WebPlatformAuthHooks
-{
+class WebPlatformAuthHooks {
+  public static function onExtensionRegistration() {
+    require_once( __DIR__ . '/../vendor/autoload.php' );
+  }
   /**
    * Disable redundant Special pages
    *
diff --git a/includes/WebPlatformAuthUserFactory.php 
b/includes/WebPlatformAuthUserFactory.php
index 5ea8bfd..5a99665 100644
--- a/includes/WebPlatformAuthUserFactory.php
+++ b/includes/WebPlatformAuthUserFactory.php
@@ -7,8 +7,7 @@
  * https://docs.webplatform.org/wiki/WPD:Projects/SSO/MediaWikiExtension
  **/
 
-class WebPlatformAuthUserFactory
-{
+class WebPlatformAuthUserFactory {
   /**
    * Return a user object
    *
diff --git a/vendor/.gitkeep b/vendor/.gitkeep
deleted file mode 100644
index e69de29..0000000
--- a/vendor/.gitkeep
+++ /dev/null

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic645e5ddd36bfb25149c832d3836d3b11683cc09
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WebPlatformAuth
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>

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

Reply via email to