Addshore has uploaded a new change for review.
https://gerrit.wikimedia.org/r/231999
Change subject: Stop UnresolvedRedirectException extending StorageException
......................................................................
Stop UnresolvedRedirectException extending StorageException
Change-Id: Ide8891f00b386353b57f6a95a76660d3615db5c0
---
M lib/includes/store/EntityRevisionLookup.php
M lib/includes/store/UnresolvedRedirectException.php
M lib/includes/store/sql/WikiPageEntityRevisionLookup.php
M lib/tests/phpunit/MockRepository.php
M lib/tests/phpunit/MockRepositoryTest.php
M repo/includes/Interactors/ItemMergeInteractor.php
6 files changed, 9 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/99/231999/7
diff --git a/lib/includes/store/EntityRevisionLookup.php
b/lib/includes/store/EntityRevisionLookup.php
index 10763fc..a08b13f 100644
--- a/lib/includes/store/EntityRevisionLookup.php
+++ b/lib/includes/store/EntityRevisionLookup.php
@@ -45,7 +45,7 @@
* to indicate that the latest revision is required.
LATEST_FROM_MASTER would force the
* revision to be determined from the canonical master database.
*
- * @throws StorageException
+ * @throws StorageException|UnresolvedRedirectException
* @return EntityRevision|null
*/
public function getEntityRevision( EntityId $entityId, $revisionId =
self::LATEST_FROM_SLAVE );
diff --git a/lib/includes/store/UnresolvedRedirectException.php
b/lib/includes/store/UnresolvedRedirectException.php
index f8eb87d..5bbfc8c 100644
--- a/lib/includes/store/UnresolvedRedirectException.php
+++ b/lib/includes/store/UnresolvedRedirectException.php
@@ -2,6 +2,7 @@
namespace Wikibase\Lib\Store;
+use Exception;
use Wikibase\DataModel\Entity\EntityId;
/**
@@ -11,7 +12,7 @@
* @license GPL 2+
* @author Daniel Kinzler
*/
-class UnresolvedRedirectException extends StorageException {
+class UnresolvedRedirectException extends Exception {
/**
* @var EntityId
diff --git a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
index e12ff47..32362f9 100644
--- a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
+++ b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php
@@ -55,7 +55,7 @@
* @param EntityId $entityId
* @param int|string $revisionId The desired revision id, or
LATEST_FROM_SLAVE or LATEST_FROM_MASTER.
*
- * @throws StorageException
+ * @throws StorageException|UnresolvedRedirectException
* @return EntityRevision|null
*/
public function getEntityRevision( EntityId $entityId, $revisionId =
self::LATEST_FROM_SLAVE ) {
diff --git a/lib/tests/phpunit/MockRepository.php
b/lib/tests/phpunit/MockRepository.php
index 56a3bfc..b2d1bbb 100644
--- a/lib/tests/phpunit/MockRepository.php
+++ b/lib/tests/phpunit/MockRepository.php
@@ -119,7 +119,7 @@
* @param EntityId $entityId
* @param int|string $revisionId The desired revision id, or
LATEST_FROM_SLAVE or LATEST_FROM_MASTER.
*
- * @throws StorageException
+ * @throws StorageException|UnresolvedRedirectException
* @return EntityRevision|null
*/
public function getEntityRevision( EntityId $entityId, $revisionId =
self::LATEST_FROM_SLAVE ) {
diff --git a/lib/tests/phpunit/MockRepositoryTest.php
b/lib/tests/phpunit/MockRepositoryTest.php
index d8910bb..34060b4 100644
--- a/lib/tests/phpunit/MockRepositoryTest.php
+++ b/lib/tests/phpunit/MockRepositoryTest.php
@@ -648,8 +648,8 @@
$redirect = new EntityRedirect( new ItemId( 'Q11' ), new
ItemId( 'Q1' ) );
$this->repo->putRedirect( $redirect );
+ $this->setExpectedException(
'Wikibase\Lib\Store\UnresolvedRedirectException' );
$this->repo->deleteEntity( $redirect->getEntityId(), 'testing',
$GLOBALS['wgUser'] );
- $this->assertNull( $this->repo->getEntity(
$redirect->getEntityId() ) );
}
public function testUpdateWatchlist() {
diff --git a/repo/includes/Interactors/ItemMergeInteractor.php
b/repo/includes/Interactors/ItemMergeInteractor.php
index e566e20..4ee1349 100644
--- a/repo/includes/Interactors/ItemMergeInteractor.php
+++ b/repo/includes/Interactors/ItemMergeInteractor.php
@@ -14,6 +14,7 @@
use Wikibase\Lib\Store\EntityRevisionLookup;
use Wikibase\Lib\Store\EntityStore;
use Wikibase\Lib\Store\StorageException;
+use Wikibase\Lib\Store\UnresolvedRedirectException;
use Wikibase\Repo\Store\EntityPermissionChecker;
use Wikibase\Summary;
use Wikibase\SummaryFormatter;
@@ -212,6 +213,8 @@
return $revision->getEntity();
} catch ( StorageException $ex ) {
throw new ItemMergeException( $ex->getMessage(),
'cant-load-entity-content', $ex );
+ } catch ( UnresolvedRedirectException $ex ) {
+ throw new ItemMergeException( $ex->getMessage(),
'cant-load-entity-content', $ex );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/231999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide8891f00b386353b57f6a95a76660d3615db5c0
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits