jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/331802 )
Change subject: Rm b/c code
......................................................................
Rm b/c code
Change-Id: I5df347a57b39d0ec5a811fe832b65af07e12e1e9
---
M includes/ApiGraph.php
1 file changed, 10 insertions(+), 46 deletions(-)
Approvals:
Yurik: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/ApiGraph.php b/includes/ApiGraph.php
index f2f387e..82c8748 100644
--- a/includes/ApiGraph.php
+++ b/includes/ApiGraph.php
@@ -29,31 +29,17 @@
if ( $params['title'] !== null ) {
if ( $params['hash'] === null ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError(
- [
'apierror-invalidparammix-mustusewith', 'title', 'hash' ], 'missingparam'
- );
- } else {
- $this->dieUsage( 'Parameter "hash" is
required', 'missingparam' );
- }
+ $this->dieWithError( [
'apierror-invalidparammix-mustusewith', 'title', 'hash' ],
+ 'missingparam' );
}
$graph = $this->getFromStorage( $params['title'],
$params['hash'] );
} else {
if ( !$this->getRequest()->wasPosted() ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError(
'apierror-graph-mustposttext', 'mustposttext' );
- } else {
- $this->dieUsage( 'Request had to be
POSTed when used with "text" parameter', 'mustposttext' );
- }
+ $this->dieWithError(
'apierror-graph-mustposttext', 'mustposttext' );
}
if ( $params['hash'] !== null ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError(
- [
'apierror-invalidparammix-cannotusewith', 'hash', 'text' ], 'invalidparammix'
- );
- } else {
- $this->dieUsage( 'Parameter "hash"
cannot be used with "text"', 'invalidparammix' );
- }
+ $this->dieWithError( [
'apierror-invalidparammix-cannotusewith', 'hash', 'text' ],
+ 'invalidparammix' );
}
$graph = $this->preprocess( $params['text'] );
}
@@ -101,11 +87,7 @@
$st = FormatJson::parse( $text );
}
if ( !$st->isOK() ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError(
'apierror-graph-invalid', 'invalidtext' );
- } else {
- $this->dieUsage( 'Graph is not valid.',
'invalidtext' );
- }
+ $this->dieWithError( 'apierror-graph-invalid',
'invalidtext' );
}
}
return $st->getValue();
@@ -125,26 +107,12 @@
if ( !$graph ) {
$title = Title::newFromText( $titleText );
if ( !$title ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError( [
'apierror-invalidtitle', wfEscapeWikiText( $titleText ) ] );
- } else {
- $this->dieUsage( 'Invalid title
given.', 'invalidtitle' );
- }
+ $this->dieWithError( [ 'apierror-invalidtitle',
wfEscapeWikiText( $titleText ) ] );
}
if ( !$title->exists() ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) )
{
- $this->dieWithError(
'apierror-missingtitle' );
- } else {
- $this->dieUsage( 'The page you
specified doesn\'t exist.', 'missingtitle' );
- }
+ $this->dieWithError( 'apierror-missingtitle' );
}
- if ( is_callable( [ $this, 'checkTitleUserPermissions'
] ) ) {
- $this->checkTitleUserPermissions( $title,
'read' );
- } else {
- if ( !$title->userCan( 'read', $this->getUser()
) ) {
- $this->dieUsage( "You don't have
permission to view this page", 'permissiondenied' );
- }
- }
+ $this->checkTitleUserPermissions( $title, 'read' );
$ppValue = $this->getDB()->selectField( 'page_props',
'pp_value', [
'pp_page' => $title->getArticleID(),
@@ -170,11 +138,7 @@
}
}
if ( !$graph ) {
- if ( is_callable( [ $this, 'dieWithError' ] ) ) {
- $this->dieWithError( 'apierror-graph-missing',
'invalidhash' );
- } else {
- $this->dieUsage( 'No graph found.',
'invalidhash' );
- }
+ $this->dieWithError( 'apierror-graph-missing',
'invalidhash' );
}
return $graph;
}
--
To view, visit https://gerrit.wikimedia.org/r/331802
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5df347a57b39d0ec5a811fe832b65af07e12e1e9
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Yurik <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits