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

Change subject: Convert p2wiki to use skin registration
......................................................................


Convert p2wiki to use skin registration

Change-Id: Ib15e61d10cbbc6fbef378b8633d48c3947a7f029
---
D P2wiki.i18n.php
M p2wiki.php
A skin.json
3 files changed, 47 insertions(+), 53 deletions(-)

Approvals:
  Florianschmidtwelzow: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/P2wiki.i18n.php b/P2wiki.i18n.php
deleted file mode 100644
index 73610f1..0000000
--- a/P2wiki.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( 'wfJsonI18nShim41dccf09caecc0cd' ) ) {
-       function wfJsonI18nShim41dccf09caecc0cd( $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'][] = 
'wfJsonI18nShim41dccf09caecc0cd';
-}
diff --git a/p2wiki.php b/p2wiki.php
index 3e2863f..c005906 100644
--- a/p2wiki.php
+++ b/p2wiki.php
@@ -22,21 +22,15 @@
  * require_once("$IP/skins/p2wiki/p2wiki.php");
  */
 
-if( !defined( 'MEDIAWIKI' ) ) die( "This is an extension to the MediaWiki 
package and cannot be run standalone." );
-
-$wgExtensionCredits['skin'][] = array (
-       'path' => __FILE__,
-       'name' => 'P2 wiki',
-       'author' => array('[http://automattic.com/ Automattic]', 
'[https://www.mediawiki.org/wiki/User:Dantman Daniel Friesen]'),
-       'description-msg' => 'p2wiki-desc',
-       'url' => 'https://www.mediawiki.org/wiki/Skin:P2_wiki'
-);
-
-$skinID = basename(dirname(__FILE__));
-$wgValidSkinNames[$skinID] = 'P2wiki';
-$wgAutoloadClasses['SkinP2wiki'] = dirname(__FILE__).'/P2wiki.skin.php';
-$wgMessagesDirs['SkinP2wiki'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['SkinP2wiki'] = dirname(__FILE__).'/P2wiki.i18n.php';
-$wgResourceModules["skins.$skinID"] = array(
-       'styles' => array( "skins/$skinID/style/screen.css" => array( 'media' 
=> 'screen' ) )
-);
+if ( function_exists( 'wfLoadSkin' ) ) {
+       wfLoadSkin( 'p2wiki' );
+       // Keep i18n globals so mergeMessageFileList.php doesn't break
+       $wgMessagesDirs['p2wiki'] = __DIR__ . '/i18n';
+       /*wfWarn(
+               'Deprecated PHP entry point used for p2wiki skin. Please use 
wfLoadSkin instead, ' .
+               'see https://www.mediawiki.org/wiki/Extension_registration for 
more details.'
+       );*/
+       return;
+} else {
+       die( 'This version of the p2wiki skin requires MediaWiki 1.25+' );
+}
diff --git a/skin.json b/skin.json
new file mode 100644
index 0000000..ef8d1b5
--- /dev/null
+++ b/skin.json
@@ -0,0 +1,35 @@
+{
+       "name": "P2 wiki",
+       "author": [
+               "[http://automattic.com/ Automattic]",
+               "[https://www.mediawiki.org/wiki/User:Dantman Daniel Friesen]"
+       ],
+       "descriptionmsg": "p2wiki-desc",
+       "url": "https://www.mediawiki.org/wiki/Skin:P2_wiki";,
+       "type": "skin",
+       "ValidSkinNames": {
+               "p2wiki": "P2wiki"
+       },
+       "AutoloadClasses": {
+               "SkinP2wiki": "P2wiki.skin.php"
+       },
+       "MessagesDirs": {
+               "SkinP2wiki": [
+                       "i18n"
+               ]
+       },
+       "ResourceFileModulePaths": {
+               "localBasePath": "",
+               "remoteSkinPath": "p2wiki"
+       },
+       "ResourceModules": {
+               "skins.p2wiki": {
+                       "styles": {
+                               "style/screen.css": {
+                                       "media": "screen"
+                               }
+                       }
+               }
+       },
+       "manifest_version": 1
+}
\ No newline at end of file

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib15e61d10cbbc6fbef378b8633d48c3947a7f029
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/skins/p2wiki
Gerrit-Branch: master
Gerrit-Owner: MtDu <justin.d...@gmail.com>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: MtDu <justin.d...@gmail.com>
Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com>
Gerrit-Reviewer: Siebrand <siebr...@kitano.nl>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to