jenkins-bot has submitted this change and it was merged.
Change subject: Remove protected methods from ModifyClaim
......................................................................
Remove protected methods from ModifyClaim
Change-Id: Ie7a8f33f9c41c523228a2ee3bfc6c75b48df2347
---
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/RemoveReferences.php
M repo/includes/api/SetClaim.php
M repo/includes/api/SetClaimValue.php
M repo/includes/api/SetQualifier.php
M repo/includes/api/SetReference.php
9 files changed, 137 insertions(+), 96 deletions(-)
Approvals:
Thiemo Mättig (WMDE): Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/includes/api/CreateClaim.php
b/repo/includes/api/CreateClaim.php
index 99676f9..09044f4 100644
--- a/repo/includes/api/CreateClaim.php
+++ b/repo/includes/api/CreateClaim.php
@@ -57,9 +57,12 @@
$entityId = $this->modificationHelper->getEntityIdFromString(
$params['entity'] );
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -82,10 +85,10 @@
$statement =
$entity->getStatements()->getFirstStatementWithGuid(
$changeOp->getStatementGuid() );
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
- $this->getResultBuilder()->addStatement( $statement );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->addStatement( $statement );
}
/**
@@ -159,6 +162,14 @@
self::PARAM_TYPE => 'text',
self::PARAM_REQUIRED => false,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/ModifyClaim.php
b/repo/includes/api/ModifyClaim.php
index 374fd33..e5c057a 100644
--- a/repo/includes/api/ModifyClaim.php
+++ b/repo/includes/api/ModifyClaim.php
@@ -4,13 +4,10 @@
use ApiBase;
use ApiMain;
-use Status;
use Wikibase\DataModel\Entity\Entity;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Services\Statement\StatementGuidParser;
-use Wikibase\Lib\Store\EntityRevisionLookup;
use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Summary;
/**
* Base class for modifying claims.
@@ -40,17 +37,17 @@
/**
* @var ResultBuilder
*/
- private $resultBuilder;
+ protected $resultBuilder;
/**
* @var EntityLoadingHelper
*/
- private $entityLoadingHelper;
+ protected $entityLoadingHelper;
/**
* @var EntitySavingHelper
*/
- private $entitySavingHelper;
+ protected $entitySavingHelper;
/**
* @param ApiMain $mainModule
@@ -76,49 +73,6 @@
$this->resultBuilder = $apiHelperFactory->getResultBuilder(
$this );
$this->entityLoadingHelper =
$apiHelperFactory->getEntityLoadingHelper( $this );
$this->entitySavingHelper =
$apiHelperFactory->getEntitySavingHelper( $this );
- }
-
- /**
- * @see EntitySavingHelper::attemptSaveEntity
- */
- protected function attemptSaveEntity( Entity $entity, $summary, $flags
= 0 ) {
- return $this->entitySavingHelper->attemptSaveEntity( $entity,
$summary, $flags );
- }
-
- /**
- * @return ResultBuilder
- */
- protected function getResultBuilder() {
- return $this->resultBuilder;
- }
-
- /**
- * @see EntitySavingHelper::loadEntityRevision
- */
- protected function loadEntityRevision(
- EntityId $entityId,
- $revId = EntityRevisionLookup::LATEST_FROM_MASTER
- ) {
- return $this->entityLoadingHelper->loadEntityRevision(
$entityId, $revId );
- }
-
- /**
- * @see ApiBase::getAllowedParams
- */
- protected function getAllowedParams() {
- return array_merge(
- parent::getAllowedParams(),
- array(
- 'summary' => array(
- self::PARAM_TYPE => 'string',
- ),
- 'token' => null,
- 'baserevid' => array(
- self::PARAM_TYPE => 'integer',
- ),
- 'bot' => false,
- )
- );
}
}
diff --git a/repo/includes/api/RemoveClaims.php
b/repo/includes/api/RemoveClaims.php
index a820a20..c50815b 100644
--- a/repo/includes/api/RemoveClaims.php
+++ b/repo/includes/api/RemoveClaims.php
@@ -59,9 +59,12 @@
$params = $this->extractRequestParams();
$entityId = $this->getEntityId( $params );
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -80,10 +83,10 @@
$this->errorReporter->dieException( $e, 'failed-save' );
}
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
- $this->getResultBuilder()->setList( null, 'claims',
$params['claim'], 'claim' );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->setList( null, 'claims',
$params['claim'], 'claim' );
}
/**
@@ -184,6 +187,14 @@
self::PARAM_ISMULTI => true,
self::PARAM_REQUIRED => true,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/RemoveQualifiers.php
b/repo/includes/api/RemoveQualifiers.php
index e639fbc..1f67c66 100644
--- a/repo/includes/api/RemoveQualifiers.php
+++ b/repo/includes/api/RemoveQualifiers.php
@@ -59,9 +59,12 @@
$guid = $params['claim'];
$entityId = $this->guidParser->parse( $guid )->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
$summary = $this->modificationHelper->createSummary( $params,
$this );
@@ -79,9 +82,9 @@
$this->errorReporter->dieException( $e, 'failed-save' );
}
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
}
/**
@@ -160,6 +163,14 @@
self::PARAM_REQUIRED => true,
self::PARAM_ISMULTI => true,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/RemoveReferences.php
b/repo/includes/api/RemoveReferences.php
index 6602f1e..1a8658e 100644
--- a/repo/includes/api/RemoveReferences.php
+++ b/repo/includes/api/RemoveReferences.php
@@ -59,9 +59,12 @@
$guid = $params['statement'];
$entityId = $this->guidParser->parse( $guid )->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
$summary = $this->modificationHelper->createSummary( $params,
$this );
@@ -86,9 +89,9 @@
$this->errorReporter->dieException( $e, 'failed-save' );
}
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
}
/**
@@ -167,6 +170,14 @@
self::PARAM_REQUIRED => true,
self::PARAM_ISMULTI => true,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/SetClaim.php b/repo/includes/api/SetClaim.php
index 4d21856..d665d8b 100644
--- a/repo/includes/api/SetClaim.php
+++ b/repo/includes/api/SetClaim.php
@@ -86,9 +86,12 @@
$entityId = $claimGuid->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -101,10 +104,10 @@
$this->modificationHelper->applyChangeOp( $changeop, $entity,
$summary );
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
- $this->getResultBuilder()->addStatement( $claim );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->addStatement( $claim );
}
/**
@@ -204,6 +207,14 @@
'index' => array(
self::PARAM_TYPE => 'integer',
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/SetClaimValue.php
b/repo/includes/api/SetClaimValue.php
index 7a70f44..f50e9e0 100644
--- a/repo/includes/api/SetClaimValue.php
+++ b/repo/includes/api/SetClaimValue.php
@@ -57,9 +57,12 @@
$guid = $params['claim'];
$entityId = $this->guidParser->parse( $guid )->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -73,10 +76,10 @@
$this->modificationHelper->applyChangeOp( $changeOp, $entity,
$summary );
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
- $this->getResultBuilder()->addStatement( $claim );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->addStatement( $claim );
}
/**
@@ -122,6 +125,14 @@
self::PARAM_TYPE => array( 'value',
'novalue', 'somevalue' ),
self::PARAM_REQUIRED => true,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/SetQualifier.php
b/repo/includes/api/SetQualifier.php
index ef6cf06..74a8637 100644
--- a/repo/includes/api/SetQualifier.php
+++ b/repo/includes/api/SetQualifier.php
@@ -58,9 +58,12 @@
$entityId = $this->guidParser->parse( $params['claim']
)->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -75,10 +78,10 @@
$changeOp = $this->getChangeOp();
$this->modificationHelper->applyChangeOp( $changeOp, $entity,
$summary );
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $this->getResultBuilder()->addRevisionIdFromStatusToResult(
$status, 'pageinfo' );
- $this->getResultBuilder()->markSuccess();
- $this->getResultBuilder()->addStatement( $statement );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->addStatement( $statement );
}
/**
@@ -192,6 +195,14 @@
self::PARAM_TYPE => 'string',
self::PARAM_REQUIRED => false,
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
diff --git a/repo/includes/api/SetReference.php
b/repo/includes/api/SetReference.php
index c8fa0f9..8c03196 100644
--- a/repo/includes/api/SetReference.php
+++ b/repo/includes/api/SetReference.php
@@ -69,9 +69,12 @@
$entityId = $this->guidParser->parse( $params['statement']
)->getEntityId();
if ( isset( $params['baserevid'] ) ) {
- $entityRevision = $this->loadEntityRevision( $entityId,
(int)$params['baserevid'] );
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision(
+ $entityId,
+ (int)$params['baserevid']
+ );
} else {
- $entityRevision = $this->loadEntityRevision( $entityId
);
+ $entityRevision =
$this->entityLoadingHelper->loadEntityRevision( $entityId );
}
$entity = $entityRevision->getEntity();
@@ -106,11 +109,10 @@
$changeOp = $this->getChangeOp( $newReference );
$this->modificationHelper->applyChangeOp( $changeOp, $entity,
$summary );
- $status = $this->attemptSaveEntity( $entity, $summary,
EDIT_UPDATE );
- $resultBuilder = $this->getResultBuilder();
- $resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
- $resultBuilder->markSuccess();
- $resultBuilder->addReference( $newReference );
+ $status = $this->entitySavingHelper->attemptSaveEntity(
$entity, $summary, EDIT_UPDATE );
+ $this->resultBuilder->addRevisionIdFromStatusToResult( $status,
'pageinfo' );
+ $this->resultBuilder->markSuccess();
+ $this->resultBuilder->addReference( $newReference );
}
/**
@@ -208,6 +210,14 @@
'index' => array(
self::PARAM_TYPE => 'integer',
),
+ 'summary' => array(
+ self::PARAM_TYPE => 'string',
+ ),
+ 'token' => null,
+ 'baserevid' => array(
+ self::PARAM_TYPE => 'integer',
+ ),
+ 'bot' => false,
),
parent::getAllowedParams()
);
--
To view, visit https://gerrit.wikimedia.org/r/266796
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie7a8f33f9c41c523228a2ee3bfc6c75b48df2347
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits