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

Change subject: Hygiene: Stop using deprecated setWarning and dieUsage
......................................................................


Hygiene: Stop using deprecated setWarning and dieUsage

Changes:
 - removed setWarning() calls
 - removed dieUsage() calls
 - removed unused imports
 - bump required MediaWiki version to 1.29 as addWarning is
 available since 1.29

Bug: T166714
Change-Id: I10369458e51e3b2d4694fa241e9cc2e3b23d83ed
---
M extension.json
M includes/api/ApiMobileView.php
2 files changed, 13 insertions(+), 43 deletions(-)

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



diff --git a/extension.json b/extension.json
index 029eb2d..3807daf 100644
--- a/extension.json
+++ b/extension.json
@@ -18,7 +18,7 @@
        "license-name": "GPL-2.0+",
        "type": "other",
        "requires": {
-               "MediaWiki": ">= 1.27.0"
+               "MediaWiki": ">= 1.29.0"
        },
        "callback": "MobileFrontendHooks::onRegistration",
        "ConfigRegistry": {
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index c4e357c..40d2b63 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -109,11 +109,8 @@
                $this->mainPage = $this->isMainPage( $title );
                if ( $this->mainPage && $this->noHeadings ) {
                        $this->noHeadings = false;
-                       if ( is_callable( [ $this, 'addWarning' ] ) ) {
-                               $this->addWarning( 
'apiwarn-mobilefrontend-ignoringnoheadings', 'ignoringnoheadings' );
-                       } else {
-                               $this->setWarning( "``noheadings'' makes no 
sense on the main page, ignoring" );
-                       }
+                       $this->addWarning( 
'apiwarn-mobilefrontend-ignoringnoheadings', 'ignoringnoheadings' );
+
                }
                if ( isset( $prop['normalizedtitle'] ) && 
$title->getPrefixedText() != $params['page'] ) {
                        $resultObj->addValue( null, $moduleName,
@@ -256,15 +253,11 @@
                        );
                }
                if ( count( $missingSections ) && isset( $prop['text'] ) ) {
-                       if ( is_callable( [ $this, 'addWarning' ] ) ) {
-                               $this->addWarning( [
-                                       
'apiwarn-mobilefrontend-sectionsnotfound',
-                                       Message::listParam( $missingSections ),
-                                       count( $missingSections )
-                               ], 'sectionsnotfound' );
-                       } else {
-                               $this->setWarning( 'Section(s) ' . implode( ', 
', $missingSections ) . ' not found' );
-                       }
+                       $this->addWarning( [
+                               'apiwarn-mobilefrontend-sectionsnotfound',
+                               Message::listParam( $missingSections ),
+                               count( $missingSections )
+                       ], 'sectionsnotfound' );
                }
                if ( $this->maxlen < 0 ) {
                        // There is more data available
@@ -295,21 +288,13 @@
        protected function makeTitle( $name ) {
                $title = Title::newFromText( $name );
                if ( !$title ) {
-                       if ( is_callable( [ $this, 'dieWithError' ] ) ) {
-                               $this->dieWithError( [ 'apierror-invalidtitle', 
wfEscapeWikiText( $name ) ] );
-                       } else {
-                               $this->dieUsageMsg( [ 'invalidtitle', $name ] );
-                       }
+                       $this->dieWithError( [ 'apierror-invalidtitle', 
wfEscapeWikiText( $name ) ] );
                }
                if ( $title->inNamespace( NS_FILE ) ) {
                        $this->file = $this->findFile( $title );
                }
                if ( !$title->exists() && !$this->file ) {
-                       if ( is_callable( [ $this, 'dieWithError' ] ) ) {
-                               $this->dieWithError( [ 'apierror-missingtitle' 
] );
-                       } else {
-                               $this->dieUsageMsg( [ 'notanarticle' ] );
-                       }
+                       $this->dieWithError( [ 'apierror-missingtitle' ] );
                }
                return $title;
        }
@@ -585,11 +570,7 @@
                        if ( !$latest ) {
                                // 
https://bugzilla.wikimedia.org/show_bug.cgi?id=53378
                                // Title::exists() above doesn't seem to always 
catch recently deleted pages
-                               if ( is_callable( [ $this, 'dieWithError' ] ) ) 
{
-                                       $this->dieWithError( [ 
'apierror-missingtitle' ] );
-                               } else {
-                                       $this->dieUsageMsg( [ 'notanarticle' ] 
);
-                               }
+                               $this->dieWithError( [ 'apierror-missingtitle' 
] );
                        }
                        $parserOptions = $this->makeParserOptions( $wp );
                        $parserCacheKey = ParserCache::singleton()->getKey( 
$wp, $parserOptions );
@@ -615,11 +596,7 @@
                } else {
                        $parserOutput = $this->getParserOutput( $wp, 
$parserOptions, $oldid );
                        if ( $parserOutput === false ) {
-                               if ( is_callable( [ $this, 'dieWithError' ] ) ) 
{
-                                       $this->dieWithError( 
'apierror-mobilefrontend-badidtitle', 'invalidparams' );
-                               } else {
-                                       $this->dieUsage( 'Bad revision id/title 
combination', 'invalidparams' );
-                               }
+                               $this->dieWithError( 
'apierror-mobilefrontend-badidtitle', 'invalidparams' );
                                return;
                        }
                        $html = $parserOutput->getText();
@@ -736,14 +713,7 @@
                if ( isset( $params['thumbsize'] )
                        && ( isset( $params['thumbwidth'] ) || isset( 
$params['thumbheight'] ) )
                ) {
-                       if ( is_callable( [ $this, 'dieWithError' ] ) ) {
-                               $this->dieWithError( 
'apierror-mobilefrontend-toomanysizeparams', 'toomanysizeparams' );
-                       } else {
-                               $this->dieUsage(
-                                       "`thumbsize' is mutually exclusive with 
`thumbwidth' and `thumbheight'",
-                                       'toomanysizeparams'
-                               );
-                       }
+                       $this->dieWithError( 
'apierror-mobilefrontend-toomanysizeparams', 'toomanysizeparams' );
                }
 
                $file = $this->findFile( $data['image'] );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I10369458e51e3b2d4694fa241e9cc2e3b23d83ed
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Pmiazga <pmia...@wikimedia.org>
Gerrit-Reviewer: Jdlrobson <jrob...@wikimedia.org>
Gerrit-Reviewer: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Pmiazga <pmia...@wikimedia.org>
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