[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[master]: Cleanup backwards-compatibility code

2016-10-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Cleanup backwards-compatibility code
..


Cleanup backwards-compatibility code

https://www.mediawiki.org/wiki/Extension:Scribunto says that master
requires 1.25+, so let's remove checks for stuff that was added before
that.

* PPFrame::getTTL() was in 1.24.
* PPFrame::setTTL() was in 1.24.
* PPFrame::isVolatile() was in 1.24.
* Parser::fetchCurrentRevisionOfTitle() was in 1.24.
* ObjectCache::getLocalServerInstance() was added in 1.27, so restore the call 
to ObjectCache::newAccelerator() as BC.

This also removes BC with the php-luasandbox extension older than 1.6, which
was released before MediaWiki 1.22.

Bug: T148012
Change-Id: I36e37f3b65d0f167e1d28b00e0842d9721feee31
---
D Scribunto.i18n.php
M Scribunto.php
M common/ApiScribuntoConsole.php
M common/Hooks.php
M common/ScribuntoContent.php
M engines/LuaCommon/LuaCommon.php
M engines/LuaCommon/LuaInterpreter.php
M engines/LuaCommon/TitleLibrary.php
M engines/LuaSandbox/Engine.php
M engines/LuaStandalone/LuaStandaloneEngine.php
M tests/engines/LuaCommon/CommonTest.php
M tests/engines/LuaCommon/LanguageLibraryTest.php
M tests/engines/LuaSandbox/SandboxTest.php
13 files changed, 57 insertions(+), 134 deletions(-)

Approvals:
  Paladox: Looks good to me, but someone else must approve
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Scribunto.i18n.php b/Scribunto.i18n.php
deleted file mode 100644
index 838da4e..000
--- a/Scribunto.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-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( 'wfJsonI18nShimc5d9278c8d74fbc1' ) ) {
-   function wfJsonI18nShimc5d9278c8d74fbc1( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = __DIR__ . "/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'][] = 
'wfJsonI18nShimc5d9278c8d74fbc1';
-}
diff --git a/Scribunto.php b/Scribunto.php
index 883b663..9e4f09f 100644
--- a/Scribunto.php
+++ b/Scribunto.php
@@ -51,6 +51,8 @@
 $wgAutoloadClasses['Scribunto_LuaError'] = __DIR__ . 
'/engines/LuaCommon/LuaCommon.php';
 $wgAutoloadClasses['Scribunto_LuaInterpreterNotFoundError'] =
__DIR__ . '/engines/LuaCommon/LuaInterpreter.php';
+$wgAutoloadClasses['Scribunto_LuaInterpreterBadVersionError'] =
+   __DIR__ . '/engines/LuaCommon/LuaInterpreter.php';
 $wgAutoloadClasses['Scribunto_LuaSandboxInterpreter'] = __DIR__ . 
'/engines/LuaSandbox/Engine.php';
 $wgAutoloadClasses['Scribunto_LuaSandboxCallback'] = __DIR__ . 
'/engines/LuaSandbox/Engine.php';
 $wgAutoloadClasses['Scribunto_LuaStandaloneInterpreterFunction'] =
diff --git a/common/ApiScribuntoConsole.php b/common/ApiScribuntoConsole.php
index 7276b3c..56ecd5f 100644
--- a/common/ApiScribuntoConsole.php
+++ b/common/ApiScribuntoConsole.php
@@ -149,23 +149,4 @@
),
);
}
-
-   /**
-* @deprecated since MediaWiki core 1.25
-*/
-   public function getParamDescription() {
-   return array(
-   'title' => 'The module title to test',
-   'content' => 'The new content of the module',
-   'question' => 'The next line to evaluate as a script',
-   'clear' => 'Set this to true to clear the current 
session state',
-   );
-   }
-
-   /**
-* @deprecated since MediaWiki core 1.25
-*/
-   public function getDescription() {
-   return 'Internal module for servicing XHR requests from the 
Scrib

[MediaWiki-commits] [Gerrit] mediawiki...Scribunto[master]: Cleanup backwards-compatibility code

2016-10-13 Thread Anomie (Code Review)
Anomie has uploaded a new change for review.

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

Change subject: Cleanup backwards-compatibility code
..

Cleanup backwards-compatibility code

https://www.mediawiki.org/wiki/Extension:Scribunto says that master
requires 1.25+, so let's remove checks for stuff that was added before
that.

* PPFrame::getTTL() was in 1.24.
* PPFrame::setTTL() was in 1.24.
* PPFrame::isVolatile() was in 1.24.
* Parser::fetchCurrentRevisionOfTitle() was in 1.24.
* ObjectCache::getLocalServerInstance() was added in 1.27, so restore the call 
to ObjectCache::newAccelerator() as BC.

This also removes BC with the php-luasandbox extension older than 1.6, which
was released before MediaWiki 1.22.

Bug: T148012
Change-Id: I36e37f3b65d0f167e1d28b00e0842d9721feee31
---
D Scribunto.i18n.php
M Scribunto.php
M common/ApiScribuntoConsole.php
M common/Hooks.php
M common/ScribuntoContent.php
M engines/LuaCommon/LuaCommon.php
M engines/LuaCommon/LuaInterpreter.php
M engines/LuaCommon/TitleLibrary.php
M engines/LuaSandbox/Engine.php
M engines/LuaStandalone/LuaStandaloneEngine.php
M tests/engines/LuaCommon/CommonTest.php
M tests/engines/LuaCommon/LanguageLibraryTest.php
M tests/engines/LuaSandbox/SandboxTest.php
13 files changed, 57 insertions(+), 134 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/89/315689/1

diff --git a/Scribunto.i18n.php b/Scribunto.i18n.php
deleted file mode 100644
index 838da4e..000
--- a/Scribunto.i18n.php
+++ /dev/null
@@ -1,35 +0,0 @@
-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( 'wfJsonI18nShimc5d9278c8d74fbc1' ) ) {
-   function wfJsonI18nShimc5d9278c8d74fbc1( $cache, $code, &$cachedData ) {
-   $codeSequence = array_merge( array( $code ), 
$cachedData['fallbackSequence'] );
-   foreach ( $codeSequence as $csCode ) {
-   $fileName = __DIR__ . "/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'][] = 
'wfJsonI18nShimc5d9278c8d74fbc1';
-}
diff --git a/Scribunto.php b/Scribunto.php
index 883b663..9e4f09f 100644
--- a/Scribunto.php
+++ b/Scribunto.php
@@ -51,6 +51,8 @@
 $wgAutoloadClasses['Scribunto_LuaError'] = __DIR__ . 
'/engines/LuaCommon/LuaCommon.php';
 $wgAutoloadClasses['Scribunto_LuaInterpreterNotFoundError'] =
__DIR__ . '/engines/LuaCommon/LuaInterpreter.php';
+$wgAutoloadClasses['Scribunto_LuaInterpreterBadVersionError'] =
+   __DIR__ . '/engines/LuaCommon/LuaInterpreter.php';
 $wgAutoloadClasses['Scribunto_LuaSandboxInterpreter'] = __DIR__ . 
'/engines/LuaSandbox/Engine.php';
 $wgAutoloadClasses['Scribunto_LuaSandboxCallback'] = __DIR__ . 
'/engines/LuaSandbox/Engine.php';
 $wgAutoloadClasses['Scribunto_LuaStandaloneInterpreterFunction'] =
diff --git a/common/ApiScribuntoConsole.php b/common/ApiScribuntoConsole.php
index 7276b3c..56ecd5f 100644
--- a/common/ApiScribuntoConsole.php
+++ b/common/ApiScribuntoConsole.php
@@ -149,23 +149,4 @@
),
);
}
-
-   /**
-* @deprecated since MediaWiki core 1.25
-*/
-   public function getParamDescription() {
-   return array(
-   'title' => 'The module title to test',
-   'content' => 'The new content of the module',
-   'question' => 'The next line to evaluate as a script',
-   'clear' => 'Set this to true to clear the current 
session state',
-   );
-   }
-
-   /**
-* @deprecated since MediaWiki core 1.25
-*/
-   public function getDescription() {
-   return 'Internal module for servicing XHR requests from the 
Scribunto