Hoo man has uploaded a new change for review.

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

Change subject: Don't use the super-evil Settings singleton in client/repo
......................................................................

Don't use the super-evil Settings singleton in client/repo

Change-Id: I50692c8091bcf4e2e0cbb23e50dd5b67b5d428a2
---
M client/includes/store/sql/DirectSqlStore.php
M lib/tests/phpunit/NoBadDependencyUsageTest.php
M repo/Wikibase.hooks.php
M repo/includes/MultiLangConstraintDetector.php
M repo/includes/NamespaceUtils.php
M repo/includes/api/ApiWikibase.php
M repo/includes/api/EditEntity.php
M repo/includes/api/GetEntities.php
M repo/includes/api/LinkTitles.php
M repo/includes/api/ModifyEntity.php
M repo/includes/api/SetSiteLink.php
M repo/includes/specials/SpecialItemByTitle.php
M repo/includes/specials/SpecialModifyEntity.php
M repo/includes/specials/SpecialSetSiteLink.php
M repo/includes/store/StoreFactory.php
M repo/includes/store/sql/SqlIdGenerator.php
M repo/includes/store/sql/SqlStore.php
M repo/tests/phpunit/includes/api/TermTestHelper.php
M repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php
M repo/tests/phpunit/includes/store/sql/TermSearchKeyBuilderTest.php
M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
21 files changed, 109 insertions(+), 53 deletions(-)


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

diff --git a/client/includes/store/sql/DirectSqlStore.php 
b/client/includes/store/sql/DirectSqlStore.php
index 1a0b639..eb74c22 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -5,6 +5,7 @@
 use Language;
 use Site;
 use ObjectCache;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Implementation of the client store interface using direct access to the 
repository's
@@ -86,7 +87,7 @@
                $this->repoWiki = $repoWiki;
                $this->language = $wikiLanguage;
 
-               $settings = Settings::singleton();
+               $settings = WikibaseRepo::getDefaultInstance()->getSettings();
                $cachePrefix = $settings->getSetting( 'sharedCacheKeyPrefix' );
                $cacheDuration = $settings->getSetting( 'sharedCacheDuration' );
                $cacheType = $settings->getSetting( 'sharedCacheType' );
@@ -312,7 +313,10 @@
         * @return PropertyInfoTable
         */
        protected function newPropertyInfoTable() {
-               if ( Settings::get( 'usePropertyInfoTable' ) ) {
+               $usePropertyInfoTable = WikibaseRepo::getDefaultInstance()
+                       ->getSettings()->getSetting( 'usePropertyInfoTable' );
+
+               if ( $usePropertyInfoTable ) {
                        $table = new PropertyInfoTable( true, $this->repoWiki );
                        $key = $this->cachePrefix . ':CachingPropertyInfoStore';
                        return new CachingPropertyInfoStore( $table, 
ObjectCache::getInstance( $this->cacheType ),
diff --git a/lib/tests/phpunit/NoBadDependencyUsageTest.php 
b/lib/tests/phpunit/NoBadDependencyUsageTest.php
index 8aa7522..1318f9d 100644
--- a/lib/tests/phpunit/NoBadDependencyUsageTest.php
+++ b/lib/tests/phpunit/NoBadDependencyUsageTest.php
@@ -28,8 +28,8 @@
 
        public function testNoSettingsUsageOutsideLib() {
                // Increasing this allowance is forbidden
-               $this->assertStringNotInRepo( 'Settings::', 21 );
-               $this->assertStringNotInClient( 'Settings::', 3 );
+               $this->assertStringNotInRepo( 'Settings::', 1 );
+               $this->assertStringNotInClient( 'Settings::', 1 );
        }
 
        private function assertStringNotInLib( $string, $maxAllowance ) {
diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index 8979730..e167296 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -7,7 +7,6 @@
 use Content;
 use ContentHandler;
 use DatabaseUpdater;
-use EditPage;
 use HistoryPager;
 use Html;
 use Language;
@@ -77,7 +76,8 @@
                wfProfileIn( __METHOD__ );
                global $wgNamespaceContentModels;
 
-               $namespaces = Settings::get( 'entityNamespaces' );
+               $namespaces = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'entityNamespaces' );
 
                if ( empty( $namespaces ) ) {
                        wfProfileOut( __METHOD__ );
@@ -137,7 +137,10 @@
                        wfWarn( "Database type '$type' is not supported by the 
Wikibase repository." );
                }
 
-               if ( Settings::get( 'defaultStore' ) === 'sqlstore' ) {
+               $defaultStore = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'defaultStore' );
+
+               if ( $defaultStore === 'sqlstore' ) {
                        /**
                         * @var SQLStore $store
                         */
diff --git a/repo/includes/MultiLangConstraintDetector.php 
b/repo/includes/MultiLangConstraintDetector.php
index ab224f1..a0fc72e 100644
--- a/repo/includes/MultiLangConstraintDetector.php
+++ b/repo/includes/MultiLangConstraintDetector.php
@@ -4,6 +4,7 @@
 
 use Status;
 use Diff\Diff;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Detector for multilang constraint violations.
@@ -70,11 +71,12 @@
         */
        public function addConstraintChecks( Entity $entity, Status $status, 
EntityDiff $diff = null, array $limits = null ) {
                global $wgLang;
+               $settings = WikibaseRepo::getDefaultInstance()->getSettings();
 
-               $truncateLength = Settings::get( 'multilang-truncate-length' );
+               $truncateLength = $settings->getSetting( 
'multilang-truncate-length' );
 
                if ( !isset( $limits ) ) {
-                       $limits = Settings::get( 'multilang-limits' );
+                       $limits = $settings->getSetting( 'multilang-limits' );
                }
 
                $diffs = array(
diff --git a/repo/includes/NamespaceUtils.php b/repo/includes/NamespaceUtils.php
index 75d4554..97e09be 100644
--- a/repo/includes/NamespaceUtils.php
+++ b/repo/includes/NamespaceUtils.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace Wikibase;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Utility functions for Wikibase namespaces.
@@ -22,7 +23,8 @@
         * @return array [ content model id (string) -> namespace id (integer) ]
         */
        public static function getEntityNamespaces() {
-               $namespaces = Settings::get( 'entityNamespaces' );
+               $namespaces = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'entityNamespaces' );
 
                if ( !is_array( $namespaces ) ) {
                        return array();
diff --git a/repo/includes/api/ApiWikibase.php 
b/repo/includes/api/ApiWikibase.php
index d70fdd8..27bf734 100644
--- a/repo/includes/api/ApiWikibase.php
+++ b/repo/includes/api/ApiWikibase.php
@@ -5,7 +5,6 @@
 use Message;
 use MessageCache;
 use Revision;
-use SiteSQLStore;
 use Title;
 use User;
 use Status;
diff --git a/repo/includes/api/EditEntity.php b/repo/includes/api/EditEntity.php
index f4a40fd..9ff897d 100644
--- a/repo/includes/api/EditEntity.php
+++ b/repo/includes/api/EditEntity.php
@@ -17,7 +17,6 @@
 use Wikibase\ChangeOp\ChangeOpDescription;
 use Wikibase\ChangeOp\ChangeOpException;
 use Wikibase\ChangeOp\ChangeOpLabel;
-use Wikibase\ChangeOp\ChangeOpMainSnak;
 use Wikibase\ChangeOp\ChangeOpSiteLink;
 use Wikibase\ChangeOp\ChangeOps;
 use Wikibase\DataModel\Claim\Claim;
@@ -30,7 +29,6 @@
 use Wikibase\Lib\ClaimGuidGenerator;
 use Wikibase\Lib\Serializers\SerializerFactory;
 use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Settings;
 use Wikibase\Summary;
 use Wikibase\Utils;
 use WikiPage;
@@ -374,7 +372,7 @@
                        $this->dieUsage( "List of sitelinks must be an array", 
'not-recognized-array' );
                }
 
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
 
                foreach ( $siteLinks as $siteId => $arg ) {
                        $this->checkSiteLinks( $arg, $siteId, $sites );
diff --git a/repo/includes/api/GetEntities.php 
b/repo/includes/api/GetEntities.php
index f27ccc3..8072919 100644
--- a/repo/includes/api/GetEntities.php
+++ b/repo/includes/api/GetEntities.php
@@ -12,7 +12,6 @@
 use Wikibase\Lib\Serializers\SerializationOptions;
 use Wikibase\Lib\Serializers\EntitySerializer;
 use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Settings;
 use Wikibase\StringNormalizer;
 use Wikibase\Utils;
 use Wikibase\StoreFactory;
@@ -45,12 +44,21 @@
         */
        private $siteLinkTargetProvider;
 
+       /**
+        * @since 0.5
+        *
+        * @var array
+        */
+       protected $siteLinkGroups;
+
        public function __construct( ApiMain $main, $name, $prefix = '' ) {
                parent::__construct( $main, $name, $prefix );
+               $wikibaseRepo = WikibaseRepo::getDefaultInstance();
 
-               $this->stringNormalizer = 
WikibaseRepo::getDefaultInstance()->getStringNormalizer();
-               $this->languageFallbackChainFactory = 
WikibaseRepo::getDefaultInstance()->getLanguageFallbackChainFactory();
+               $this->stringNormalizer = $wikibaseRepo->getStringNormalizer();
+               $this->languageFallbackChainFactory = 
$wikibaseRepo->getLanguageFallbackChainFactory();
                $this->siteLinkTargetProvider = new SiteLinkTargetProvider( 
SiteSQLStore::newInstance() );
+               $this->siteLinkGroups = 
$wikibaseRepo->getSettings()->getSetting( 'siteLinkGroups' );
        }
 
        /**
@@ -242,7 +250,7 @@
         * @see ApiBase::getAllowedParams()
         */
        public function getAllowedParams() {
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
                return array_merge( parent::getAllowedParams(), array(
                        'ids' => array(
                                ApiBase::PARAM_TYPE => 'string',
diff --git a/repo/includes/api/LinkTitles.php b/repo/includes/api/LinkTitles.php
index 8502766..5f1dcab 100644
--- a/repo/includes/api/LinkTitles.php
+++ b/repo/includes/api/LinkTitles.php
@@ -9,9 +9,9 @@
 use Wikibase\EntityContent;
 use Wikibase\ItemContent;
 use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Settings;
 use Wikibase\StoreFactory;
 use Wikibase\Summary;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * API module to associate two pages on two different sites with a Wikibase 
item.
@@ -29,9 +29,18 @@
         */
        private $siteLinkTargetProvider;
 
+       /**
+        * @since 0.5
+        *
+        * @var array
+        */
+       protected $siteLinkGroups;
+
        public function __construct( $mainModule, $moduleName, $modulePrefix = 
'' ) {
                parent::__construct( $mainModule, $moduleName, $modulePrefix );
                $this->siteLinkTargetProvider = new SiteLinkTargetProvider( 
SiteSQLStore::newInstance() );
+               $this->siteLinkGroups = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'siteLinkGroups' );
        }
 
        /**
@@ -55,7 +64,7 @@
                $this->validateParameters( $params );
 
                // Sites are already tested through allowed params ;)
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
                $fromSite = $sites->getSite( $params['fromsite'] );
                $toSite = $sites->getSite( $params['tosite'] );
 
@@ -211,7 +220,7 @@
         * @return array|bool
         */
        public function getAllowedParams() {
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
                return array_merge( parent::getAllowedParams(), array(
                        'tosite' => array(
                                ApiBase::PARAM_TYPE => 
$sites->getGlobalIdentifiers(),
diff --git a/repo/includes/api/ModifyEntity.php 
b/repo/includes/api/ModifyEntity.php
index 51ec7c6..eb38280 100644
--- a/repo/includes/api/ModifyEntity.php
+++ b/repo/includes/api/ModifyEntity.php
@@ -15,7 +15,6 @@
 use Wikibase\EntityContent;
 use Wikibase\ItemHandler;
 use Wikibase\Repo\WikibaseRepo;
-use Wikibase\Settings;
 use Wikibase\StringNormalizer;
 use Wikibase\Summary;
 
@@ -41,11 +40,20 @@
         */
        protected $siteLinkTargetProvider;
 
+       /**
+        * @since 0.5
+        *
+        * @var array
+        */
+       protected $siteLinkGroups;
+
        public function __construct( ApiMain $main, $name, $prefix = '' ) {
                parent::__construct( $main, $name, $prefix );
 
                $this->stringNormalizer = 
WikibaseRepo::getDefaultInstance()->getStringNormalizer();
                $this->siteLinkTargetProvider = new SiteLinkTargetProvider( 
SiteSQLStore::newInstance() );
+               $this->siteLinkGroups = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'siteLinkGroups' );
        }
 
        /**
@@ -175,7 +183,10 @@
                                $this->dieUsage( "Badges: entity with id 
'{$badgeSerialization}' is not an item", 'not-item' );
                        }
 
-                       if ( !in_array( $badgeId->getPrefixedId(), array_keys( 
Settings::get( 'badgeItems' ) ) ) ) {
+                       $badgeItems = WikibaseRepo::getDefaultInstance()->
+                               getSettings()->getSetting( 'badgeItems' );
+
+                       if ( !in_array( $badgeId->getPrefixedId(), array_keys( 
$badgeItems ) ) ) {
                                $this->dieUsage( "Badges: item 
'{$badgeSerialization}' is not a badge", 'not-badge' );
                        }
 
@@ -372,7 +383,7 @@
         * @return array the allowed params
         */
        public function getAllowedParamsForSiteLink() {
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
                return array(
                        'site' => array(
                                ApiBase::PARAM_TYPE => 
$sites->getGlobalIdentifiers(),
diff --git a/repo/includes/api/SetSiteLink.php 
b/repo/includes/api/SetSiteLink.php
index ac6dc55..1f907da 100644
--- a/repo/includes/api/SetSiteLink.php
+++ b/repo/includes/api/SetSiteLink.php
@@ -6,7 +6,6 @@
 use ApiBase;
 use Wikibase\EntityContent;
 use Wikibase\ItemContent;
-use Wikibase\Settings;
 
 /**
  * API module to associate a page on a site with a Wikibase entity or remove 
an already made such association.
@@ -114,7 +113,7 @@
                        return new ChangeOpSiteLink( $linksite );
                } else {
                        $linksite = $this->stringNormalizer->trimToNFC( 
$params['linksite'] );
-                       $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+                       $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
                        $site = $sites->getSite( $linksite );
 
                        if ( $site === false ) {
@@ -164,7 +163,7 @@
         * @return array|bool
         */
        public function getAllowedParams() {
-               $sites = $this->siteLinkTargetProvider->getSiteList( 
Settings::get( 'siteLinkGroups' ) );
+               $sites = $this->siteLinkTargetProvider->getSiteList( 
$this->siteLinkGroups );
 
                // Experimental setting of badges in api
                // @todo remove experimental once JS UI is in place, (also 
remove the experimental examples below and TESTS)
diff --git a/repo/includes/specials/SpecialItemByTitle.php 
b/repo/includes/specials/SpecialItemByTitle.php
index b475746..9092a27 100644
--- a/repo/includes/specials/SpecialItemByTitle.php
+++ b/repo/includes/specials/SpecialItemByTitle.php
@@ -4,7 +4,7 @@
 use Html;
 use Site;
 use Wikibase\ItemHandler;
-use Wikibase\Settings;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Enables accessing items by providing the identifier of a site and the title
@@ -62,8 +62,12 @@
 
                        $itemHandler = new ItemHandler();
                        $itemContent = $itemHandler->getContentFromSiteLink( 
$siteId, $pageName );
+
+                       $normalizeItemByTitlePageNames = 
WikibaseRepo::getDefaultInstance()->
+                               getSettings()->getSetting( 
'normalizeItemByTitlePageNames' );
+
                        // Do we have an item content, and if not can we try 
harder?
-                       if ( $itemContent === null && Settings::get( 
'normalizeItemByTitlePageNames' ) === true ) {
+                       if ( $itemContent === null && 
$normalizeItemByTitlePageNames === true ) {
                                // Try harder by requesting normalization on 
the external site
                                $siteObj = 
\SiteSQLStore::newInstance()->getSite( $siteId );
                                if ( $siteObj instanceof Site ) {
@@ -94,7 +98,8 @@
         */
        protected function switchForm( $siteId, $page ) {
 
-               $groups = Settings::get( 'siteLinkGroups' );
+               $groups = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'siteLinkGroups' );
                $sites = \SiteSQLStore::newInstance()->getSites();
 
                if ( $sites->hasSite( $siteId ) ) {
diff --git a/repo/includes/specials/SpecialModifyEntity.php 
b/repo/includes/specials/SpecialModifyEntity.php
index c576a2b..d203d73 100644
--- a/repo/includes/specials/SpecialModifyEntity.php
+++ b/repo/includes/specials/SpecialModifyEntity.php
@@ -3,14 +3,9 @@
 namespace Wikibase\Repo\Specials;
 
 use Html;
-use RuntimeException;
-use UserBlockedError;
 use UserInputException;
 use Wikibase\EditEntity;
-use Wikibase\EntityId;
-use Wikibase\Repo\WikibaseRepo;
 use Wikibase\Summary;
-use Wikibase\SummaryFormatter;
 
 /**
  * Abstract special page for modifying Wikibase entity.
diff --git a/repo/includes/specials/SpecialSetSiteLink.php 
b/repo/includes/specials/SpecialSetSiteLink.php
index 0261ba9..371eeb5 100644
--- a/repo/includes/specials/SpecialSetSiteLink.php
+++ b/repo/includes/specials/SpecialSetSiteLink.php
@@ -14,7 +14,6 @@
 use Wikibase\EntityContent;
 use Wikibase\ItemContent;
 use Wikibase\Summary;
-use Wikibase\Settings;
 use Wikibase\Repo\WikibaseRepo;
 
 /**
@@ -381,7 +380,10 @@
                                return false;
                        }
 
-                       if ( !in_array( $badgeId->getPrefixedId(), array_keys( 
Settings::get( 'badgeItems' ) ) ) ) {
+                       $badgeItems = 
WikibaseRepo::getDefaultInstance()->getSettings()
+                                       ->getSetting( 'badgeItems' );
+
+                       if ( !in_array( $badgeId->getPrefixedId(), array_keys( 
$badgeItems ) ) ) {
                                $status->fatal( 
'wikibase-setsitelink-not-badge', $badgeId->getPrefixedId() );
                                return false;
                        }
diff --git a/repo/includes/store/StoreFactory.php 
b/repo/includes/store/StoreFactory.php
index 47f5cdd..a822b54 100644
--- a/repo/includes/store/StoreFactory.php
+++ b/repo/includes/store/StoreFactory.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace Wikibase;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Factory for obtaining a store instance.
@@ -26,8 +27,11 @@
        public static function getStore( $store = false, $reset = 'no' ) {
                global $wgWBStores;
                static $instances = array();
+               $defaultStore = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'defaultStore' );
 
-               $store = $store === false || !array_key_exists( $store, 
$wgWBStores ) ? Settings::get( 'defaultStore' ) : $store;
+               $store = $store === false || !array_key_exists( $store, 
$wgWBStores ) ?
+                               $defaultStore : $store;
 
                if ( $reset !== true && $reset !== 'reset'
                        && isset( $instances[$store] ) ) {
diff --git a/repo/includes/store/sql/SqlIdGenerator.php 
b/repo/includes/store/sql/SqlIdGenerator.php
index ecc351c..ac5d21a 100644
--- a/repo/includes/store/sql/SqlIdGenerator.php
+++ b/repo/includes/store/sql/SqlIdGenerator.php
@@ -1,6 +1,7 @@
 <?php
 
 namespace Wikibase;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * Unique Id generator implemented using an SQL table.
@@ -114,7 +115,10 @@
                        throw new \MWException( 'Could not generate a reliably 
unique ID.' );
                }
 
-               if ( in_array( $id, Settings::get( 'idBlacklist' ) ) ) {
+               $idBlacklist = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'idBlacklist' );
+
+               if ( in_array( $id, $idBlacklist ) ) {
                        $id = $this->generateNewId( $type );
                }
 
diff --git a/repo/includes/store/sql/SqlStore.php 
b/repo/includes/store/sql/SqlStore.php
index 9df3849..0ef64da 100644
--- a/repo/includes/store/sql/SqlStore.php
+++ b/repo/includes/store/sql/SqlStore.php
@@ -62,8 +62,7 @@
        private $cacheDuration;
 
        public function __construct() {
-               //NOTE: once I59e8423c is in, we no longer need the singleton.
-               $settings = Settings::singleton();
+               $settings = WikibaseRepo::getDefaultInstance()->getSettings();
                $cachePrefix = $settings->getSetting( 'sharedCacheKeyPrefix' );
                $cacheDuration = $settings->getSetting( 'sharedCacheDuration' );
                $cacheType = $settings->getSetting( 'sharedCacheType' );
@@ -261,10 +260,11 @@
         * @param DatabaseBase $db
         */
        private function updateTermsTable( DatabaseUpdater $updater, 
DatabaseBase $db ) {
+               $withoutTermSearchKey = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'withoutTermSearchKey' );
 
                // ---- Update from 0.1 or 0.2. ----
-               if ( !$db->fieldExists( 'wb_terms', 'term_search_key' ) &&
-                       !Settings::get( 'withoutTermSearchKey' ) ) {
+               if ( !$db->fieldExists( 'wb_terms', 'term_search_key' ) && 
!$withoutTermSearchKey ) {
 
                        $updater->addExtensionField(
                                'wb_terms',
@@ -448,7 +448,10 @@
         * @return PropertyInfoTable
         */
        protected function newPropertyInfoTable() {
-               if ( Settings::get( 'usePropertyInfoTable' ) ) {
+               $usePropertyInfoTable = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'usePropertyInfoTable' );
+
+               if ( $usePropertyInfoTable ) {
                        $table = new PropertyInfoTable( false );
                        $key = $this->cachePrefix . ':CachingPropertyInfoStore';
                        return new CachingPropertyInfoStore( $table, 
ObjectCache::getInstance( $this->cacheType ),
diff --git a/repo/tests/phpunit/includes/api/TermTestHelper.php 
b/repo/tests/phpunit/includes/api/TermTestHelper.php
index 9bd6fd9..889050d 100644
--- a/repo/tests/phpunit/includes/api/TermTestHelper.php
+++ b/repo/tests/phpunit/includes/api/TermTestHelper.php
@@ -2,7 +2,7 @@
 
 namespace Wikibase\Test\Api;
 
-use Wikibase\Settings;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @licence GNU GPL v2+
@@ -13,7 +13,8 @@
 
        public static function makeOverlyLongString( $text = "Test", $length = 
null ) {
                if ( $length === null ) {
-                       $limits = Settings::get( 'multilang-limits' );
+                       $limits = WikibaseRepo::getDefaultInstance()->
+                               getSettings()->getSetting( 'multilang-limits' );
                        $length = $limits['length'];
                }
 
diff --git a/repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php 
b/repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php
index 4cb5b9d..a85bda7 100644
--- a/repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php
+++ b/repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php
@@ -3,8 +3,8 @@
 namespace Wikibase\Test;
 
 use Wikibase\IdGenerator;
-use Wikibase\Settings;
 use Wikibase\StoreFactory;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\SqlIdGenerator
@@ -26,9 +26,11 @@
                 * @var IdGenerator $clone
                 */
                $generator = StoreFactory::getStore( 'sqlstore' 
)->newIdGenerator();
+               $idBlacklist = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'idBlacklist' );
 
                for ( $i = 0; $i < 45; ++$i ) {
-                       $this->assertFalse( in_array( $generator->getNewId( 
'blacklisttest' ), Settings::get( 'idBlacklist' ) ) );
+                       $this->assertFalse( in_array( $generator->getNewId( 
'blacklisttest' ), $idBlacklist ) );
                }
        }
 
diff --git a/repo/tests/phpunit/includes/store/sql/TermSearchKeyBuilderTest.php 
b/repo/tests/phpunit/includes/store/sql/TermSearchKeyBuilderTest.php
index 2eeed29..6260569 100644
--- a/repo/tests/phpunit/includes/store/sql/TermSearchKeyBuilderTest.php
+++ b/repo/tests/phpunit/includes/store/sql/TermSearchKeyBuilderTest.php
@@ -3,11 +3,10 @@
 namespace Wikibase\Test;
 
 use Wikibase\Item;
-use Wikibase\Settings;
 use Wikibase\StoreFactory;
-use Wikibase\TermSqlIndex;
 use Wikibase\Term;
 use Wikibase\TermSearchKeyBuilder;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\TermSearchKeyBuilder
@@ -46,7 +45,10 @@
         * @param boolean $matches
         */
        public function testRebuildSearchKey( $languageCode, $termText, 
$searchText, $matches ) {
-               if ( Settings::get( 'withoutTermSearchKey' ) ) {
+               $withoutTermSearchKey = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'withoutTermSearchKey' );
+
+               if ( $withoutTermSearchKey ) {
                        $this->markTestSkipped( "can't test search key if 
withoutTermSearchKey option is set." );
                }
 
diff --git a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php 
b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
index eae70f5..71869f3 100644
--- a/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
+++ b/repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php
@@ -4,10 +4,10 @@
 
 use Wikibase\DataModel\SimpleSiteLink;
 use Wikibase\Item;
-use Wikibase\Settings;
 use Wikibase\StringNormalizer;
 use Wikibase\Term;
 use Wikibase\TermSqlIndex;
+use Wikibase\Repo\WikibaseRepo;
 
 /**
  * @covers Wikibase\TermSqlIndex
@@ -48,7 +48,10 @@
         * @param boolean $matches
         */
        public function testGetMatchingTerms2( $languageCode, $termText, 
$searchText, $matches ) {
-               if ( Settings::get( 'withoutTermSearchKey' ) ) {
+               $withoutTermSearchKey = WikibaseRepo::getDefaultInstance()->
+                       getSettings()->getSetting( 'withoutTermSearchKey' );
+
+               if ( $withoutTermSearchKey ) {
                        $this->markTestSkipped( "can't test search key if 
withoutTermSearchKey option is set." );
                }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I50692c8091bcf4e2e0cbb23e50dd5b67b5d428a2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to