[MediaWiki-commits] [Gerrit] Removed legacy PHP i18n shim file + replaced dirname(__FILE_... - change (mediawiki...FanBoxes)

2015-07-26 Thread Jack Phoenix (Code Review)
Jack Phoenix has submitted this change and it was merged.

Change subject: Removed legacy PHP i18n shim file + replaced dirname(__FILE__) 
with __DIR__
..


Removed legacy PHP i18n shim file + replaced dirname(__FILE__) with __DIR__

Change-Id: I15d03bbde8c3b33d3f5c1a97e1538cccb3bec9c8
---
D FanBox.i18n.php
M FanBoxHooks.php
M FanBoxes.php
3 files changed, 16 insertions(+), 54 deletions(-)

Approvals:
  Jack Phoenix: Verified; Looks good to me, approved



diff --git a/FanBox.i18n.php b/FanBox.i18n.php
deleted file mode 100644
index b349cb4..000
--- a/FanBox.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( 'wfJsonI18nShim1b415549cca452e5' ) ) {
-   function wfJsonI18nShim1b415549cca452e5( $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'][] = 
'wfJsonI18nShim1b415549cca452e5';
-}
diff --git a/FanBoxHooks.php b/FanBoxHooks.php
index fe9a18e..38b7d54 100644
--- a/FanBoxHooks.php
+++ b/FanBoxHooks.php
@@ -232,8 +232,7 @@
 * @return Boolean: true
 */
public static function addTables( $updater ) {
-   $dir = dirname( __FILE__ );
-   $file = $dir/fantag.sql;
+   $file = __DIR__ . '/fantag.sql';
$updater-addExtensionUpdate( array( 'addTable', 'fantag', 
$file, true ) );
$updater-addExtensionUpdate( array( 'addTable', 'user_fantag', 
$file, true ) );
return true;
diff --git a/FanBoxes.php b/FanBoxes.php
index 41e73fa..cdede1e 100644
--- a/FanBoxes.php
+++ b/FanBoxes.php
@@ -37,14 +37,14 @@
'fanbox-mustenter-right-or', 'fanbox-mustenter-title', 
'fanbox-hash',
'fanbox-choose-another', 'fanbox-upload-new-image'
),
-   'localBasePath' = dirname( __FILE__ ),
+   'localBasePath' = __DIR__,
'remoteExtPath' = 'FanBoxes',
'position' = 'top' // available since r85616
 );
 
 $wgResourceModules['ext.fanBoxes.colorpicker'] = array(
'scripts' = 'color-picker.js',
-   'localBasePath' = dirname( __FILE__ ),
+   'localBasePath' = __DIR__,
'remoteExtPath' = 'FanBoxes',
 );
 
@@ -58,21 +58,19 @@
 }
 
 // Set up the new special pages
-$dir = dirname( __FILE__ ) . '/';
 $wgMessagesDirs['FanBoxes'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['FanBoxes'] = $dir . 'FanBox.i18n.php';
-$wgExtensionMessagesFiles['FanBoxesNamespaces'] = $dir . 
'FanBox.namespaces.php';
+$wgExtensionMessagesFiles['FanBoxesNamespaces'] = __DIR__ . 
'/FanBox.namespaces.php';
 
-$wgAutoloadClasses['FanBox'] = $dir . 'FanBoxClass.php';
-$wgAutoloadClasses['SpecialFanBoxAjaxUpload'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxAjaxUploadForm'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxUpload'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxPage'] = $dir . 'FanBoxPage.php';
-$wgAutoloadClasses['FanBoxes'] = $dir . 'SpecialFanBoxes.php';
-$wgAutoloadClasses['TagCloud'] = $dir . 'TagCloudClass.php';
-$wgAutoloadClasses['TopFanBoxes'] = $dir . 'SpecialTopFanBoxes.php';
-$wgAutoloadClasses['UserFanBoxes'] = $dir . 'FanBoxesClass.php';
-$wgAutoloadClasses['ViewFanBoxes'] = $dir . 'SpecialViewFanBoxes.php';
+$wgAutoloadClasses['FanBox'] = __DIR__ . '/FanBoxClass.php';
+$wgAutoloadClasses['SpecialFanBoxAjaxUpload'] = __DIR__ . 
'/MiniAjaxUpload.php';
+$wgAutoloadClasses['FanBoxAjaxUploadForm'] = 

[MediaWiki-commits] [Gerrit] Removed legacy PHP i18n shim file + replaced dirname(__FILE_... - change (mediawiki...FanBoxes)

2015-07-26 Thread Jack Phoenix (Code Review)
Jack Phoenix has uploaded a new change for review.

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

Change subject: Removed legacy PHP i18n shim file + replaced dirname(__FILE__) 
with __DIR__
..

Removed legacy PHP i18n shim file + replaced dirname(__FILE__) with __DIR__

Change-Id: I15d03bbde8c3b33d3f5c1a97e1538cccb3bec9c8
---
D FanBox.i18n.php
M FanBoxHooks.php
M FanBoxes.php
3 files changed, 16 insertions(+), 54 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FanBoxes 
refs/changes/81/227081/1

diff --git a/FanBox.i18n.php b/FanBox.i18n.php
deleted file mode 100644
index b349cb4..000
--- a/FanBox.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( 'wfJsonI18nShim1b415549cca452e5' ) ) {
-   function wfJsonI18nShim1b415549cca452e5( $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'][] = 
'wfJsonI18nShim1b415549cca452e5';
-}
diff --git a/FanBoxHooks.php b/FanBoxHooks.php
index fe9a18e..38b7d54 100644
--- a/FanBoxHooks.php
+++ b/FanBoxHooks.php
@@ -232,8 +232,7 @@
 * @return Boolean: true
 */
public static function addTables( $updater ) {
-   $dir = dirname( __FILE__ );
-   $file = $dir/fantag.sql;
+   $file = __DIR__ . '/fantag.sql';
$updater-addExtensionUpdate( array( 'addTable', 'fantag', 
$file, true ) );
$updater-addExtensionUpdate( array( 'addTable', 'user_fantag', 
$file, true ) );
return true;
diff --git a/FanBoxes.php b/FanBoxes.php
index 41e73fa..cdede1e 100644
--- a/FanBoxes.php
+++ b/FanBoxes.php
@@ -37,14 +37,14 @@
'fanbox-mustenter-right-or', 'fanbox-mustenter-title', 
'fanbox-hash',
'fanbox-choose-another', 'fanbox-upload-new-image'
),
-   'localBasePath' = dirname( __FILE__ ),
+   'localBasePath' = __DIR__,
'remoteExtPath' = 'FanBoxes',
'position' = 'top' // available since r85616
 );
 
 $wgResourceModules['ext.fanBoxes.colorpicker'] = array(
'scripts' = 'color-picker.js',
-   'localBasePath' = dirname( __FILE__ ),
+   'localBasePath' = __DIR__,
'remoteExtPath' = 'FanBoxes',
 );
 
@@ -58,21 +58,19 @@
 }
 
 // Set up the new special pages
-$dir = dirname( __FILE__ ) . '/';
 $wgMessagesDirs['FanBoxes'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['FanBoxes'] = $dir . 'FanBox.i18n.php';
-$wgExtensionMessagesFiles['FanBoxesNamespaces'] = $dir . 
'FanBox.namespaces.php';
+$wgExtensionMessagesFiles['FanBoxesNamespaces'] = __DIR__ . 
'/FanBox.namespaces.php';
 
-$wgAutoloadClasses['FanBox'] = $dir . 'FanBoxClass.php';
-$wgAutoloadClasses['SpecialFanBoxAjaxUpload'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxAjaxUploadForm'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxUpload'] = $dir . 'MiniAjaxUpload.php';
-$wgAutoloadClasses['FanBoxPage'] = $dir . 'FanBoxPage.php';
-$wgAutoloadClasses['FanBoxes'] = $dir . 'SpecialFanBoxes.php';
-$wgAutoloadClasses['TagCloud'] = $dir . 'TagCloudClass.php';
-$wgAutoloadClasses['TopFanBoxes'] = $dir . 'SpecialTopFanBoxes.php';
-$wgAutoloadClasses['UserFanBoxes'] = $dir . 'FanBoxesClass.php';
-$wgAutoloadClasses['ViewFanBoxes'] = $dir . 'SpecialViewFanBoxes.php';
+$wgAutoloadClasses['FanBox'] = __DIR__ . '/FanBoxClass.php';
+$wgAutoloadClasses['SpecialFanBoxAjaxUpload'] = __DIR__ .