Daniel Kinzler has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179909

Change subject: TermIndex should not extend LabelConflictFinder
......................................................................

TermIndex should not extend LabelConflictFinder

Note that TermSqlIndex continues to implement both interfaces.

Change-Id: Id82333259429e0e2e42e66714e0e7597d5b901c7
---
M lib/includes/store/TermIndex.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/tests/phpunit/store/MockTermIndex.php
M repo/includes/WikibaseRepo.php
M repo/includes/store/Store.php
M repo/includes/store/sql/SqlStore.php
M repo/tests/phpunit/includes/store/StoreTest.php
7 files changed, 34 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/09/179909/1

diff --git a/lib/includes/store/TermIndex.php b/lib/includes/store/TermIndex.php
index 7c6cc9b..c33dfcc 100644
--- a/lib/includes/store/TermIndex.php
+++ b/lib/includes/store/TermIndex.php
@@ -4,7 +4,6 @@
 
 use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\EntityId;
-use Wikibase\Lib\Store\LabelConflictFinder;
 
 /**
  * Interface to a cache for terms with both write and lookup methods.
@@ -14,7 +13,7 @@
  * @licence GNU GPL v2+
  * @author Jeroen De Dauw < [email protected] >
  */
-interface TermIndex extends LabelConflictFinder {
+interface TermIndex {
 
        /**
         * Saves the terms of the provided entity in the term cache.
diff --git a/lib/includes/store/sql/TermSqlIndex.php 
b/lib/includes/store/sql/TermSqlIndex.php
index 21ae5b2..c77ebe0 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -13,6 +13,7 @@
 use Wikibase\DataModel\LegacyIdInterpreter;
 use Wikibase\DataModel\Term\Fingerprint;
 use Wikibase\DataModel\Term\FingerprintProvider;
+use Wikibase\Lib\Store\LabelConflictFinder;
 
 /**
  * Term lookup cache.
@@ -25,7 +26,7 @@
  * @author Daniel Kinzler
  * @author Denny
  */
-class TermSqlIndex extends DBAccessBase implements TermIndex {
+class TermSqlIndex extends DBAccessBase implements TermIndex, 
LabelConflictFinder {
 
        /**
         * @since 0.1
diff --git a/lib/tests/phpunit/store/MockTermIndex.php 
b/lib/tests/phpunit/store/MockTermIndex.php
index c4d3dc8..77fe107 100644
--- a/lib/tests/phpunit/store/MockTermIndex.php
+++ b/lib/tests/phpunit/store/MockTermIndex.php
@@ -6,6 +6,7 @@
 use InvalidArgumentException;
 use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\Lib\Store\LabelConflictFinder;
 use Wikibase\Term;
 use Wikibase\TermIndex;
 
@@ -24,7 +25,7 @@
  * @licence GNU GPL v2+
  * @author Daniel Kinzler
  */
-class MockTermIndex implements TermIndex {
+class MockTermIndex implements TermIndex, LabelConflictFinder {
 
        /**
         * @var Term[]
diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 368a001..68ad994 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -705,7 +705,7 @@
         * @return LabelDescriptionDuplicateDetector
         */
        public function getLabelDescriptionDuplicateDetector() {
-               return new LabelDescriptionDuplicateDetector( 
$this->getStore()->getTermIndex() );
+               return new LabelDescriptionDuplicateDetector( 
$this->getStore()->getLabelConflictFinder() );
        }
 
        /**
diff --git a/repo/includes/store/Store.php b/repo/includes/store/Store.php
index f980cc0..e21026c 100644
--- a/repo/includes/store/Store.php
+++ b/repo/includes/store/Store.php
@@ -7,6 +7,7 @@
 use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\EntityStore;
 use Wikibase\Lib\Store\EntityStoreWatcher;
+use Wikibase\Lib\Store\LabelConflictFinder;
 use Wikibase\Lib\Store\SiteLinkCache;
 use Wikibase\Repo\Store\EntityPerPage;
 
@@ -59,6 +60,15 @@
        public function getTermIndex();
 
        /**
+        * Returns a TermIndex for this store.
+        *
+        * @since 0.5
+        *
+        * @return LabelConflictFinder
+        */
+       public function getLabelConflictFinder();
+
+       /**
         * Returns a new IdGenerator for this store.
         *
         * @since 0.1
diff --git a/repo/includes/store/sql/SqlStore.php 
b/repo/includes/store/sql/SqlStore.php
index 9c27656..9dd0e10 100644
--- a/repo/includes/store/sql/SqlStore.php
+++ b/repo/includes/store/sql/SqlStore.php
@@ -18,6 +18,7 @@
 use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\EntityStore;
 use Wikibase\Lib\Store\EntityStoreWatcher;
+use Wikibase\Lib\Store\LabelConflictFinder;
 use Wikibase\Lib\Store\RedirectResolvingEntityLookup;
 use Wikibase\Lib\Store\RevisionBasedEntityLookup;
 use Wikibase\Lib\Store\SiteLinkCache;
@@ -157,6 +158,15 @@
        }
 
        /**
+        * @see Store::getLabelConflictFinder
+        *
+        * @return LabelConflictFinder
+        */
+       public function getLabelConflictFinder() {
+               return $this->getTermIndex();
+       }
+
+       /**
         * @since 0.1
         *
         * @return TermIndex
diff --git a/repo/tests/phpunit/includes/store/StoreTest.php 
b/repo/tests/phpunit/includes/store/StoreTest.php
index 148f2df..452913b 100644
--- a/repo/tests/phpunit/includes/store/StoreTest.php
+++ b/repo/tests/phpunit/includes/store/StoreTest.php
@@ -63,6 +63,14 @@
         * @dataProvider instanceProvider
         * @param Store $store
         */
+       public function testGetLabelConflictFinder( Store $store ) {
+               $this->assertInstanceOf( 
'\Wikibase\Lib\Store\LabelConflictFinder', $store->getLabelConflictFinder() );
+       }
+
+       /**
+        * @dataProvider instanceProvider
+        * @param Store $store
+        */
        public function testNewIdGenerator( Store $store ) {
                $this->assertInstanceOf( '\Wikibase\IdGenerator', 
$store->newIdGenerator() );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/179909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id82333259429e0e2e42e66714e0e7597d5b901c7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to