jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/331814 )
Change subject: Remove b/c stuff
......................................................................
Remove b/c stuff
Change-Id: I7e878442569e58e34c577d2d52e3a617e3858f04
---
M includes/JCApi.php
M includes/JCDataApi.php
2 files changed, 28 insertions(+), 67 deletions(-)
Approvals:
Yurik: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/JCApi.php b/includes/JCApi.php
index 399c46a..5a33688 100644
--- a/includes/JCApi.php
+++ b/includes/JCApi.php
@@ -82,80 +82,45 @@
$this->getMain()->setCacheMaxAge( 1 ); //
seconds
$this->getMain()->setCacheMode( 'private' );
if ( !$this->getUser()->isAllowed(
'jsonconfig-flush' ) ) {
- if ( is_callable( [ $this,
'dieWithError' ] ) ) {
- // Sigh. Can't use
$this->checkUserRightsAny() because
- // this has to break API
conventions by returning 401
- // (and violate the HTTP RFC by
doing so without a
- // WWW-Authenticate header).
- $this->dieWithError(
- [
-
'apierror-permissiondenied',
- $this->msg(
"action-jsonconfig-flush" )
- ],
- 'permissiondenied', [],
401
- );
- } else {
- $this->dieUsage(
- "Must be authenticated
with jsonconfig-flush right to use this API",
- 'login', 401
- );
- }
+ // Sigh. Can't use
$this->checkUserRightsAny() because
+ // this has to break API conventions by
returning 401
+ // (and violate the HTTP RFC by doing
so without a
+ // WWW-Authenticate header).
+ $this->dieWithError(
+ [
+
'apierror-permissiondenied',
+ $this->msg(
"action-jsonconfig-flush" )
+ ],
+ 'permissiondenied', [], 401
+ );
}
if ( !isset( $params['namespace'] ) ) {
- if ( is_callable( [ $this,
'dieWithError' ] ) ) {
- $this->dieWithError(
- [
'apierror-jsonconfig-paramrequired', 'namespace' ],
- 'badparam-namespace'
- );
- } else {
- $this->dieUsage(
- 'Parameter "namespace"
is required for this command',
- 'badparam-namespace'
- );
- }
+ $this->dieWithError(
+ [
'apierror-jsonconfig-paramrequired', 'namespace' ],
+ 'badparam-namespace'
+ );
}
if ( !isset( $params['title'] ) ) {
- if ( is_callable( [ $this,
'dieWithError' ] ) ) {
- $this->dieWithError(
- [
'apierror-jsonconfig-paramrequired', 'title' ], 'badparam-title'
- );
- } else {
- $this->dieUsage(
- 'Parameter "title" is
required for this command', 'badparam-title'
- );
- }
+ $this->dieWithError(
+ [
'apierror-jsonconfig-paramrequired', 'title' ], 'badparam-title'
+ );
}
$jct = JCSingleton::parseTitle(
$params['title'], $params['namespace'] );
if ( !$jct ) {
- if ( is_callable( [ $this,
'dieWithError' ] ) ) {
- $this->dieWithError(
'apierror-jsonconfig-badtitle', 'badparam-titles' );
- } else {
- $this->dieUsage(
- 'The page specified by
"namespace" and "title" parameters ' .
- 'is either invalid or
is not registered in JsonConfig configuration',
- 'badparam-titles'
- );
- }
+ $this->dieWithError(
'apierror-jsonconfig-badtitle', 'badparam-titles' );
}
if ( isset( $params['content'] ) &&
$params['content'] !== '' ) {
if ( $command !== 'reload ' ) {
- if ( is_callable( [ $this,
'dieWithError' ] ) ) {
- $this->dieWithError(
- [
-
'apierror-invalidparammix-mustusewith',
-
'content',
-
'command=reload'
- ],
-
'badparam-content'
- );
- } else {
- $this->dieUsage(
- 'The "content"
parameter may only be used with command=reload',
-
'badparam-content'
- );
- }
+ $this->dieWithError(
+ [
+
'apierror-invalidparammix-mustusewith',
+ 'content',
+ 'command=reload'
+ ],
+ 'badparam-content'
+ );
}
$content = JCSingleton::parseContent(
$jct, $params['content'], true );
} else {
diff --git a/includes/JCDataApi.php b/includes/JCDataApi.php
index fbc75b4..40a1adc 100644
--- a/includes/JCDataApi.php
+++ b/includes/JCDataApi.php
@@ -15,11 +15,7 @@
$params = $this->extractRequestParams();
$jct = JCSingleton::parseTitle( $params['title'], NS_DATA );
if ( !$jct ) {
- 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'] ) ] );
}
$data = JCSingleton::getContent( $jct );
--
To view, visit https://gerrit.wikimedia.org/r/331814
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7e878442569e58e34c577d2d52e3a617e3858f04
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/JsonConfig
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Reedy <[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
