jenkins-bot has submitted this change and it was merged.
Change subject: Don't load sites for DirectSqlStore
......................................................................
Don't load sites for DirectSqlStore
Change-Id: Iaf28aa402b5fe49e90a5dda3bafaa70b636c393d
---
M client/includes/store/sql/DirectSqlStore.php
M client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
2 files changed, 10 insertions(+), 33 deletions(-)
Approvals:
JanZerebecki: Looks good to me, approved
jenkins-bot: Verified
diff --git a/client/includes/store/sql/DirectSqlStore.php
b/client/includes/store/sql/DirectSqlStore.php
index 3dad610..217b4df 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -121,6 +121,11 @@
private $contentCodec;
/**
+ * @var string
+ */
+ private $siteId;
+
+ /**
* @param EntityContentDataCodec $contentCodec
* @param Language $wikiLanguage
* @param EntityIdParser $entityIdParser
@@ -136,10 +141,12 @@
$this->language = $wikiLanguage;
$this->contentCodec = $contentCodec;
+ // @TODO: Inject
$settings = WikibaseClient::getDefaultInstance()->getSettings();
$cachePrefix = $settings->getSetting( 'sharedCacheKeyPrefix' );
$cacheDuration = $settings->getSetting( 'sharedCacheDuration' );
$cacheType = $settings->getSetting( 'sharedCacheType' );
+ $siteId = $settings->getSetting( 'siteGlobalID' );
$this->changesDatabase = $settings->getSetting(
'changesDatabase' );
$this->useLegacyUsageIndex = $settings->getSetting(
'useLegacyUsageIndex' );
@@ -148,6 +155,7 @@
$this->cacheDuration = $cacheDuration;
$this->cacheType = $cacheType;
$this->entityIdParser = $entityIdParser;
+ $this->siteId = $siteId;
}
/**
@@ -184,7 +192,7 @@
if ( !$this->usageLookup ) {
if ( $this->useLegacyUsageIndex ) {
$this->usageLookup = new SiteLinkUsageLookup(
- $this->getSite()->getGlobalId(),
+ $this->siteId,
$this->getSiteLinkLookup(),
new TitleFactory()
);
@@ -216,32 +224,6 @@
}
return $this->usageTracker;
- }
-
- /**
- * Sets the site object representing the local wiki.
- * For testing only!
- *
- * @todo: remove this once the Site can be injected via the constructor!
- *
- * @param Site $site
- */
- public function setSite( Site $site ) {
- $this->site = $site;
- }
-
- /**
- * Returns the site object representing the local wiki.
- *
- * @return Site
- */
- private function getSite() {
- // @FIXME: inject the site
- if ( $this->site === null ) {
- $this->site =
WikibaseClient::getDefaultInstance()->getSite();
- }
-
- return $this->site;
}
/**
diff --git a/client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
b/client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
index 1115eb0..495c9c4 100644
--- a/client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
+++ b/client/tests/phpunit/includes/store/sql/DirectSqlStoreTest.php
@@ -3,8 +3,6 @@
namespace Wikibase\Client\Tests\Store\Sql;
use Language;
-use MediaWikiSite;
-use Site;
use Wikibase\Client\WikibaseClient;
use Wikibase\DataModel\Entity\BasicEntityIdParser;
use Wikibase\DirectSqlStore;
@@ -23,15 +21,12 @@
class DirectSqlStoreTest extends \MediaWikiTestCase {
protected function newStore() {
- $site = new Site( MediaWikiSite::TYPE_MEDIAWIKI );
- $site->setGlobalId( 'dummy' );
$lang = Language::factory( 'en' );
$idParser = new BasicEntityIdParser();
$contentCodec =
WikibaseClient::getDefaultInstance()->getEntityContentDataCodec();
- $store = new DirectSqlStore( $contentCodec, $lang, $idParser,
'DirectStoreSqlTestDummyRepoId');
- $store->setSite( $site ); //TODO: inject via constructor once
that is possible
+ $store = new DirectSqlStore( $contentCodec, $lang, $idParser,
'DirectStoreSqlTestDummyRepoId' );
return $store;
}
--
To view, visit https://gerrit.wikimedia.org/r/178999
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaf28aa402b5fe49e90a5dda3bafaa70b636c393d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits