jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/403406 )

Change subject: Remove no longer needed backwards-compatibility
......................................................................


Remove no longer needed backwards-compatibility

This extension requires 1.31 (it follows the release branches compatibility
policy), so we can remove a lot of legacy checks and code.

Change-Id: Ieb42073010caffb1f6811d3a2f629aa60c1d2034
---
M common/ApiScribuntoConsole.php
M common/Hooks.php
M common/ScribuntoContent.php
M engines/LuaCommon/LuaCommon.php
4 files changed, 10 insertions(+), 50 deletions(-)

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



diff --git a/common/ApiScribuntoConsole.php b/common/ApiScribuntoConsole.php
index 6bfb7d0..28a86c6 100644
--- a/common/ApiScribuntoConsole.php
+++ b/common/ApiScribuntoConsole.php
@@ -13,11 +13,7 @@
 
                $title = Title::newFromText( $params['title'] );
                if ( !$title ) {
-                       if ( is_callable( [ $this, 'dieWithError' ] ) ) {
-                               $this->dieWithError( [ 'apierror-invalidtitle', 
wfEscapeWikiText( $params['title'] ) ] );
-                       } else {
-                               $this->dieUsageMsg( [ 'invalidtitle', 
$params['title'] ] );
-                       }
+                       $this->dieWithError( [ 'apierror-invalidtitle', 
wfEscapeWikiText( $params['title'] ) ] );
                }
 
                if ( $params['session'] ) {
@@ -59,14 +55,7 @@
                }
 
                if ( $newSession['size'] > self::SC_MAX_SIZE ) {
-                       if ( is_callable( [ $this, 'dieWithError' ] ) ) {
-                               $this->dieWithError( 
'scribunto-console-too-large' );
-                       } else {
-                               $this->dieUsage(
-                                       $this->msg( 
'scribunto-console-too-large' )->text(),
-                                       'scribunto-console-too-large'
-                               );
-                       }
+                       $this->dieWithError( 'scribunto-console-too-large' );
                }
                $result = $this->runConsole( [
                        'title' => $title,
diff --git a/common/Hooks.php b/common/Hooks.php
index ab75dd2..69d8b42 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -20,6 +20,7 @@
  * http://www.gnu.org/copyleft/gpl.html
  */
 
+use MediaWiki\MediaWikiServices;
 use RunningStat\PSquare;
 
 /**
@@ -195,12 +196,8 @@
                static $cache;
 
                if ( !$cache ) {
-                       /// @todo: Clean up when support for MW < 1.27 is 
dropped
-                       if ( is_callable( 'ObjectCache::getLocalServerInstance' 
) ) {
-                               $cache = ObjectCache::getLocalServerInstance( 
CACHE_NONE );
-                       } else {
-                               $cache = ObjectCache::newAccelerator( 
CACHE_NONE );
-                       }
+                       $cache = ObjectCache::getLocalServerInstance( 
CACHE_NONE );
+
                }
 
                // To control the sampling rate, we keep a compact histogram of
@@ -228,16 +225,7 @@
                static $stats;
 
                if ( !$stats ) {
-                       // check, if MediaWikiServices exists and has a 
StatsdDataFactory service for
-                       // backward-compatibility with MediaWiki 1.25+
-                       if (
-                               class_exists( 'MediaWiki\\MediaWikiServices' ) 
&&
-                               
\MediaWiki\MediaWikiServices::getInstance()->hasService( 'StatsdDataFactory' )
-                       ) {
-                               $stats = 
\MediaWiki\MediaWikiServices::getInstance()->getStatsdDataFactory();
-                       } else {
-                               $stats = RequestContext::getMain()->getStats();
-                       }
+                       $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
                }
 
                $metricKey = sprintf( 'scribunto.traces.%s__%s__%s', 
wfWikiId(), $moduleName, $functionName );
diff --git a/common/ScribuntoContent.php b/common/ScribuntoContent.php
index dc4f3f4..29f4878 100644
--- a/common/ScribuntoContent.php
+++ b/common/ScribuntoContent.php
@@ -105,7 +105,7 @@
                // category if it's invalid
                $status = $this->validate( $title );
                if ( !$status->isOK() ) {
-                       $output->setText( self::getPOText( $output ) .
+                       $output->setText( $output->getRawText() .
                                Html::rawElement( 'div', [ 'class' => 
'errorbox' ],
                                        $status->getHTML( 
'scribunto-error-short', 'scribunto-error-long' )
                                )
@@ -143,31 +143,19 @@
                                        if ( $wgUseSiteCss ) {
                                                $output->addModuleStyles( 
'ext.geshi.local' );
                                        }
-                                       $output->setText( self::getPOText( 
$output ) . $code );
+                                       $output->setText( $output->getRawText() 
. $code );
                                        return $output;
                                }
                        }
                }
 
                // No GeSHi, or GeSHi can't parse it, use plain <pre>
-               $output->setText( self::getPOText( $output ) .
+               $output->setText( $output->getRawText() .
                        "<pre class='mw-code mw-script' dir='ltr'>\n" .
                        htmlspecialchars( $text ) .
                        "\n</pre>\n"
                );
 
                return $output;
-       }
-
-       /**
-        * Fetch the text from a ParserOutput
-        * @todo Once support for MW < 1.27 is dropped, inline this.
-        * @param ParserOutput $po
-        * @return string
-        */
-       private static function getPOText( ParserOutput $po ) {
-               return is_callable( [ $po, 'getRawText' ] )
-                       ? $po->getRawText()
-                       : $po->getText();
        }
 }
diff --git a/engines/LuaCommon/LuaCommon.php b/engines/LuaCommon/LuaCommon.php
index b59a61e..423c217 100644
--- a/engines/LuaCommon/LuaCommon.php
+++ b/engines/LuaCommon/LuaCommon.php
@@ -337,12 +337,7 @@
                static $cache = null;
 
                if ( !$cache ) {
-                       /// @todo: Clean up when support for MW < 1.27 is 
dropped
-                       if ( is_callable( 'ObjectCache::getLocalServerInstance' 
) ) {
-                               $cache = ObjectCache::getLocalServerInstance( 
'hash' );
-                       } else {
-                               $cache = ObjectCache::newAccelerator( 'hash' );
-                       }
+                       $cache = ObjectCache::getLocalServerInstance( 'hash' );
                }
 
                $mtime = filemtime( $fileName );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ieb42073010caffb1f6811d3a2f629aa60c1d2034
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to