Isarra has uploaded a new change for review.

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

Change subject: Use extension registration and remove i18n shim because huh?
......................................................................

Use extension registration and remove i18n shim because huh?

Change-Id: I230668f418504d2117d53a0fea316d24fe73ce04
---
D GreyStuff.i18n.php
M GreyStuff.php
A skin.json
3 files changed, 43 insertions(+), 70 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/skins/GreyStuff 
refs/changes/98/212998/1

diff --git a/GreyStuff.i18n.php b/GreyStuff.i18n.php
deleted file mode 100755
index e2f6cb5..0000000
--- a/GreyStuff.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( 'wfJsonI18nShim389d8a2e6b13997e' ) ) {
-       function wfJsonI18nShim389d8a2e6b13997e( $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'][] = 
'wfJsonI18nShim389d8a2e6b13997e';
-}
diff --git a/GreyStuff.php b/GreyStuff.php
index 9785d73..33fd442 100755
--- a/GreyStuff.php
+++ b/GreyStuff.php
@@ -23,39 +23,16 @@
  * @date 2013
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       die( 'Not a valid entry point.' );
+if ( function_exists( 'wfLoadSkin' ) ) {
+       wfLoadSkin( 'GreyStuff' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['GreyStuff'] = __DIR__ . '/i18n';
+       $wgExtensionMessagesFiles['GreyStuff'] = __DIR__ . 
'/GreyStuff.alias.php';
+       wfWarn(
+               'Deprecated PHP entry point used for GreyStuff skin. Please use 
wfLoadSkin instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );
+       return;
+} else {
+       die( 'This version of the GreyStuff skin requires MediaWiki 1.25+' );
 }
-
-# Skin credits that will show up on Special:Version
-$wgExtensionCredits['skin'][] = array(
-       'path' => __FILE__,
-       'name' => 'GreyStuff skin',
-       'version' => '1.0.2',
-       'author' => array( 'Calimonius the Estrange' ),
-       'descriptionmsg' => 'greystuff-desc',
-       'url' => 'https://www.mediawiki.org/wiki/Skin:GreyStuff'
-);
-
-# Autoload the skin class, make it a valid skin, set up i18n, set up CSS & JS
-# (via ResourceLoader)
-$skinID = basename( dirname( __FILE__ ) );
-$dir = dirname( __FILE__ ) . '/';
-
-# The first instance must be strtolower()ed so that useskin=aurora works and
-# so that it does *not* force an initial capital (i.e. we do NOT want
-# useskin=greystuff) and the second instance is used to determine the name of
-# *this* file.
-$wgValidSkinNames[strtolower( $skinID )] = 'GreyStuff';
-
-$wgAutoloadClasses['SkinGreyStuff'] = $dir . 'GreyStuff.skin.php';
-$wgMessagesDirs['SkinGreyStuff'] = $dir . '/i18n';
-$wgExtensionMessagesFiles['SkinGreyStuff'] = $dir . 'GreyStuff.i18n.php';
-$wgResourceModules['skins.greystuff'] = array(
-       'styles' => array(
-               'skins/GreyStuff/resources/normalise.css',
-               'skins/GreyStuff/resources/main.less',
-       ),
-       'scripts' => '',
-       'position' => 'top'
-);
diff --git a/skin.json b/skin.json
new file mode 100644
index 0000000..edad7ae
--- /dev/null
+++ b/skin.json
@@ -0,0 +1,31 @@
+{
+       "name": "GreyStuff skin",
+       "version": "1.0.2",
+       "author": [
+               "Calimonius the Estrange"
+       ],
+       "url": "https://www.mediawiki.org/wiki/Skin:GreyStuff";,
+       "descriptionmsg": "greystuff-desc",
+       "type": "skin",
+       "ValidSkinNames": {
+               "greystuff": "GreyStuff"
+       },
+       "MessagesDirs": {
+               "SkinGreyStuff": [
+                       "/i18n"
+               ]
+       },
+       "AutoloadClasses": {
+               "SkinGreyStuff": "GreyStuff.skin.php"
+       },
+       "ResourceModules": {
+               "skins.greystuff": {
+                       "styles": [
+                               "skins/GreyStuff/resources/normalise.css",
+                               "skins/GreyStuff/resources/main.less"
+                       ],
+                       "scripts": "",
+                       "position": "top"
+               }
+       }
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I230668f418504d2117d53a0fea316d24fe73ce04
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/GreyStuff
Gerrit-Branch: master
Gerrit-Owner: Isarra <[email protected]>

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

Reply via email to