jenkins-bot has submitted this change and it was merged.
Change subject: Put common params into modifyClaim and add bot-edit flag
......................................................................
Put common params into modifyClaim and add bot-edit flag
Change-Id: Id3a06bee2046d98b0d65196b53b81b281c88a9e1
---
M repo/includes/api/CreateClaim.php
M repo/includes/api/ModifyClaim.php
M repo/includes/api/RemoveClaims.php
M repo/includes/api/RemoveQualifiers.php
M repo/includes/api/SetClaimValue.php
M repo/includes/api/SetQualifier.php
6 files changed, 39 insertions(+), 68 deletions(-)
Approvals:
Addshore: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/api/CreateClaim.php
b/repo/includes/api/CreateClaim.php
index 901fd32..5d175c5 100644
--- a/repo/includes/api/CreateClaim.php
+++ b/repo/includes/api/CreateClaim.php
@@ -144,11 +144,6 @@
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false,
),
- 'token' => null,
- 'baserevid' => array(
- ApiBase::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
)
);
}
@@ -164,13 +159,6 @@
'property' => 'Id of the snaks property',
'value' => 'Value of the snak when creating a
claim with a snak that has a value',
'snaktype' => 'The type of the snak',
- 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
- 'baserevid' => array( 'The numeric identifier
for the revision to base the modification on.',
- "This is used for detecting conflicts
during save."
- ),
- 'bot' => array( 'Mark this edit as bot',
- 'This URL flag will only be respected
if the user belongs to the group "bot".'
- ),
)
);
}
diff --git a/repo/includes/api/ModifyClaim.php
b/repo/includes/api/ModifyClaim.php
index 786cd78..af3acfd 100644
--- a/repo/includes/api/ModifyClaim.php
+++ b/repo/includes/api/ModifyClaim.php
@@ -84,7 +84,7 @@
$status = $this->attemptSaveEntity(
$content,
$summary->toString(),
- EDIT_UPDATE
+ $this->getFlags()
);
$this->addRevisionIdFromStatusToResult( 'pageinfo',
'lastrevid', $status );
@@ -121,12 +121,33 @@
}
/**
+ * @since 0.4
+ *
+ * @return integer
+ */
+ protected function getFlags() {
+ $flags = EDIT_UPDATE;
+
+ $params = $this->extractRequestParams();
+ $flags |= ( $this->getUser()->isAllowed( 'bot' ) &&
$params['bot'] ) ? EDIT_FORCE_BOT : 0;
+
+ return $flags;
+ }
+
+ /**
* @see \ApiBase::getAllowedParams
*/
public function getAllowedParams() {
return array_merge(
parent::getAllowedParams(),
- array( 'summary' => array( ApiBase::PARAM_TYPE =>
'string' ) )
+ array(
+ 'summary' => array( ApiBase::PARAM_TYPE =>
'string' ),
+ 'token' => null,
+ 'baserevid' => array(
+ ApiBase::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
+ )
);
}
@@ -136,10 +157,22 @@
public function getParamDescription() {
return array_merge(
parent::getParamDescription(),
- array( 'summary' => array( 'Summary for the edit.',
- "Will be prepended by an automatically
generated comment. The length limit of the
- autocomment together with the summary is 260
characters. Be aware that everything above that
- limit will be cut off." )
+ array(
+ 'summary' => array(
+ 'Summary for the edit.',
+ "Will be prepended by an automatically
generated comment. The length limit of the
+ autocomment together with the summary
is 260 characters. Be aware that everything above that
+ limit will be cut off."
+ ),
+ 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
+ 'baserevid' => array(
+ 'The numeric identifier for the
revision to base the modification on.',
+ "This is used for detecting conflicts
during save."
+ ),
+ 'bot' => array(
+ 'Mark this edit as bot',
+ 'This URL flag will only be respected
if the user belongs to the group "bot".'
+ ),
)
);
}
diff --git a/repo/includes/api/RemoveClaims.php
b/repo/includes/api/RemoveClaims.php
index efcb397..26030ec 100644
--- a/repo/includes/api/RemoveClaims.php
+++ b/repo/includes/api/RemoveClaims.php
@@ -184,11 +184,6 @@
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_REQUIRED => true,
),
- 'token' => null,
- 'baserevid' => array(
- ApiBase::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
)
);
}
@@ -206,13 +201,6 @@
array(
'claim' => array( 'One GUID or several
(pipe-separated) GUIDs identifying the claims to be removed.',
'All claims must belong to the same
entity.'
- ),
- 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
- 'baserevid' => array( 'The numeric identifier
for the revision to base the modification on.',
- "This is used for detecting conflicts
during save."
- ),
- 'bot' => array( 'Mark this edit as bot',
- 'This URL flag will only be respected
if the user belongs to the group "bot".'
),
)
);
diff --git a/repo/includes/api/RemoveQualifiers.php
b/repo/includes/api/RemoveQualifiers.php
index 9bfdb78..a7c46e9 100644
--- a/repo/includes/api/RemoveQualifiers.php
+++ b/repo/includes/api/RemoveQualifiers.php
@@ -157,11 +157,6 @@
ApiBase::PARAM_REQUIRED => true,
ApiBase::PARAM_ISMULTI => true,
),
- 'token' => null,
- 'baserevid' => array(
- ApiBase::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
)
);
}
@@ -193,14 +188,6 @@
array(
'claim' => 'A GUID identifying the claim from
which to remove qualifiers',
'qualifiers' => 'Snak hashes of the qualifiers
to remove',
- 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
- 'baserevid' => array(
- 'The numeric identifier for the
revision to base the modification on.',
- "This is used for detecting conflicts
during save."
- ),
- 'bot' => array( 'Mark this edit as bot',
- 'This URL flag will only be respected
if the user belongs to the group "bot".'
- ),
)
);
}
diff --git a/repo/includes/api/SetClaimValue.php
b/repo/includes/api/SetClaimValue.php
index 937e449..7048542 100644
--- a/repo/includes/api/SetClaimValue.php
+++ b/repo/includes/api/SetClaimValue.php
@@ -118,11 +118,6 @@
ApiBase::PARAM_TYPE => array( 'value',
'novalue', 'somevalue' ),
ApiBase::PARAM_REQUIRED => true,
),
- 'token' => null,
- 'baserevid' => array(
- ApiBase::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
)
);
}
@@ -150,13 +145,6 @@
'claim' => 'A GUID identifying the claim',
'snaktype' => 'The type of the snak',
'value' => 'The value to set the datavalue of
the the main snak of the claim to',
- 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
- 'baserevid' => array( 'The numeric identifier
for the revision to base the modification on.',
- "This is used for detecting conflicts
during save."
- ),
- 'bot' => array( 'Mark this edit as bot',
- 'This URL flag will only be respected
if the user belongs to the group "bot".'
- ),
)
);
}
diff --git a/repo/includes/api/SetQualifier.php
b/repo/includes/api/SetQualifier.php
index ee04fbb..975bbb1 100644
--- a/repo/includes/api/SetQualifier.php
+++ b/repo/includes/api/SetQualifier.php
@@ -165,11 +165,6 @@
ApiBase::PARAM_TYPE => 'string',
ApiBase::PARAM_REQUIRED => false,
),
- 'token' => null,
- 'baserevid' => array(
- ApiBase::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
)
);
}
@@ -201,14 +196,6 @@
'snakhash' => array(
'The hash of the snak to modify.',
'Should only be provided for existing
qualifiers'
- ),
- 'token' => 'An "edittoken" token previously
obtained through the token module (prop=info).',
- 'baserevid' => array(
- 'The numeric identifier for the
revision to base the modification on.',
- "This is used for detecting conflicts
during save."
- ),
- 'bot' => array( 'Mark this edit as bot',
- 'This URL flag will only be respected
if the user belongs to the group "bot".'
),
)
);
--
To view, visit https://gerrit.wikimedia.org/r/77890
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id3a06bee2046d98b0d65196b53b81b281c88a9e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits