Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/212787
Change subject: usePropertyInfoTable is not a repo but a lib setting
......................................................................
usePropertyInfoTable is not a repo but a lib setting
If I'm not mistaken, usePropertyInfoTable is a lib setting, used both
in client and repo. Is this correct?
This patch also reduces the usages of the long deprecated Settings
class to a single method.
Change-Id: Iced9d822cb61312b9332a1ddffb113f2a0b52233
---
M client/includes/WikibaseClient.php
M client/includes/store/sql/DirectSqlStore.php
M docs/options.wiki
M lib/includes/ChangesTable.php
M lib/includes/Settings.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/tests/phpunit/store/Sql/PropertyInfoTableTest.php
M repo/includes/WikibaseRepo.php
M repo/includes/store/sql/SqlStore.php
9 files changed, 15 insertions(+), 26 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/87/212787/1
diff --git a/client/includes/WikibaseClient.php
b/client/includes/WikibaseClient.php
index 1268c67..d9609d1 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -21,7 +21,6 @@
use Wikibase\Client\Hooks\LanguageLinkBadgeDisplay;
use Wikibase\Client\Hooks\OtherProjectsSidebarGeneratorFactory;
use Wikibase\Client\Hooks\ParserFunctionRegistrant;
-use Wikibase\Client\ParserOutputDataUpdater;
use Wikibase\Client\Store\TitleFactory;
use Wikibase\ClientStore;
use Wikibase\DataAccess\PropertyIdResolver;
@@ -58,7 +57,6 @@
use Wikibase\Lib\WikibaseSnakFormatterBuilders;
use Wikibase\Lib\WikibaseValueFormatterBuilders;
use Wikibase\NamespaceChecker;
-use Wikibase\Settings;
use Wikibase\SettingsArray;
use Wikibase\StringNormalizer;
diff --git a/client/includes/store/sql/DirectSqlStore.php
b/client/includes/store/sql/DirectSqlStore.php
index 2915d5c..71f72cd 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -432,8 +432,8 @@
*/
public function getPropertyInfoStore() {
if ( $this->propertyInfoTable === null ) {
- $usePropertyInfoTable =
WikibaseClient::getDefaultInstance()
- ->getSettings()->getSetting(
'usePropertyInfoTable' );
+ $wikibaseClient = WikibaseClient::getDefaultInstance();
+ $usePropertyInfoTable =
$wikibaseClient->getSettings()->getSetting( 'usePropertyInfoTable' );
if ( $usePropertyInfoTable ) {
$propertyInfoStore = new PropertyInfoTable(
true, $this->repoWiki );
diff --git a/docs/options.wiki b/docs/options.wiki
index 731a8dc..7c55234 100644
--- a/docs/options.wiki
+++ b/docs/options.wiki
@@ -30,6 +30,7 @@
);
</poem>
:'''Warning:''' do not change this if you already have Wikibase entities in
your database, since they may become unreadable!
+;usePropertyInfoTable: Whether to use the wb_property_info table for quick
lookup of meta-information about properties. True per default, can be set to
false in an environment where the necessary database update can't be deployed
right away. To set up the table manually, run repo/sql/wb_property_info.sql to
create it, then use repo/maintenance/rebuildPropertyInfo.php to populate the
table.
;useChangesTable: Whether to record changes in the database, so they can be
pushed to clients. Boolean, defaults to <code>true</code>. May be set to false
in situations where there are no clients to notify, to preserve space.
'''Note''' that if this is true, the <code>pruneChanges.php</code> script
should be run periodically to remove old changes from the database table.
;dispatchBatchChunkFactor: Chunk factor used internally by the
<code>dispatchChanges.php</code> script. The default is 3. If most clients are
not interested in most changes, this factor can be raised to lower the number
of database queries needed to fetch a batch of changes.
;changeHandlers: Array mapping change type IDs to handler classes. May be used
by extensions to register additional change classes.
@@ -57,7 +58,6 @@
;multilang-limits: Limits to impose on multilanguage strings like labels,
descriptions and such. Supported limits:
:;length: the maximum length of the string, in characters.
:Default: <code>array( 'length' => 250 )</code>
-;usePropertyInfoTable: Whether to use the wb_property_info table for quick
lookup of meta-information about properties. True per default, can be set to
false in an environment where the necessary database update can't be deployed
right away. To set up the table manually, run repo/sql/wb_property_info.sql to
create it, then use repo/maintenance/rebuildPropertyInfo.php to populate the
table.
;useRedirectTargetColumn: Whether to use the epp_redirect_target column in the
wb_entity_per_page table for detecting redirects. True per default, can be set
to false in an environment where the necessary database update can't be
deployed right away. To set up the table manually, run
repo/sql/AddEppRedirectTarget.sql to create it, then use
repo/maintenance/rebuildEntityPerPage.php to rebuild the table if neccessary.
;internalEntitySerializerClass: The class name of a serializer that is to be
used when serializing entities for storage. Defaults to null, causing the
default entity serializer from the SerializerFactory to be used. Should be set
to Wikibase\Lib\Serializers\LegacyInternalEntitySerializer for compatibility
with client wikis that run older code.
;transformLegacyFormatOnExport: Whether entity revisions stored in a legacy
format should be converted on the fly while exporting. Enabled per default, if
internalEntitySerializerClass is not set, and disable by default if
internalEntitySerializerClass is set. Must be disabled if
internalEntitySerializerClass is set to the legacy serializer.
diff --git a/lib/includes/ChangesTable.php b/lib/includes/ChangesTable.php
index 66e1f7d..5b31787 100644
--- a/lib/includes/ChangesTable.php
+++ b/lib/includes/ChangesTable.php
@@ -24,7 +24,8 @@
*/
public function __construct( $changesDatabase = null ) {
if ( $changesDatabase === null ) {
- $changesDatabase = Settings::get( 'changesDatabase' );
+ $settings = Settings::singleton();
+ $changesDatabase = $settings->getSetting(
'changesDatabase' );
}
$this->setTargetWiki( $changesDatabase );
@@ -78,7 +79,8 @@
* @return string
*/
public static function getClassForType( $type ) {
- $typeMap = Settings::get( 'changeHandlers' );
+ $settings = Settings::singleton();
+ $typeMap = $settings->getSetting( 'changeHandlers' );
return array_key_exists( $type, $typeMap ) ? $typeMap[$type] :
'Wikibase\ChangeRow';
}
diff --git a/lib/includes/Settings.php b/lib/includes/Settings.php
index 7aac488..958ee27 100644
--- a/lib/includes/Settings.php
+++ b/lib/includes/Settings.php
@@ -57,17 +57,4 @@
}
}
- /**
- * Shortcut to ::singleton()->getSetting
- *
- * @deprecated
- *
- * @param string $settingName
- *
- * @return mixed
- */
- public static function get( $settingName ) {
- return self::singleton()->getSetting( $settingName );
- }
-
}
diff --git a/lib/includes/store/sql/TermSqlIndex.php
b/lib/includes/store/sql/TermSqlIndex.php
index 8ca553f..31de135 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -1004,7 +1004,8 @@
* @return bool
*/
public function supportsWeight() {
- return !Settings::get( 'withoutTermWeight' );
+ $settings = Settings::singleton();
+ return !$settings->getSetting( 'withoutTermWeight' );
}
}
diff --git a/lib/tests/phpunit/store/Sql/PropertyInfoTableTest.php
b/lib/tests/phpunit/store/Sql/PropertyInfoTableTest.php
index 2a03240..7694ea5 100644
--- a/lib/tests/phpunit/store/Sql/PropertyInfoTableTest.php
+++ b/lib/tests/phpunit/store/Sql/PropertyInfoTableTest.php
@@ -2,6 +2,7 @@
namespace Wikibase\Test;
+use MediaWikiTestCase;
use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\PropertyInfoTable;
use Wikibase\Settings;
@@ -18,7 +19,7 @@
* @licence GNU GPL v2+
* @author Daniel Kinzler
*/
-class PropertyInfoTableTest extends \MediaWikiTestCase {
+class PropertyInfoTableTest extends MediaWikiTestCase {
/**
* @var PropertyInfoStoreTestHelper
@@ -38,7 +39,8 @@
$this->markTestSkipped( "Skipping because
WikibaseClient doesn't have a local wb_property_info table." );
}
- if ( !Settings::get( 'usePropertyInfoTable' ) ) {
+ $settings = Settings::singleton();
+ if ( !$settings->getSetting( 'usePropertyInfoTable' ) ) {
$this->markTestSkipped( "Skipping because
wb_property_info isn't configured." );
}
diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 56c4c12..5814c53 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -72,7 +72,6 @@
use Wikibase\Repo\Notifications\DatabaseChangeTransmitter;
use Wikibase\Repo\Notifications\DummyChangeTransmitter;
use Wikibase\Repo\Store\EntityPermissionChecker;
-use Wikibase\Settings;
use Wikibase\SettingsArray;
use Wikibase\SnakFactory;
use Wikibase\SqlStore;
diff --git a/repo/includes/store/sql/SqlStore.php
b/repo/includes/store/sql/SqlStore.php
index 29a8d3d..d9f173c 100644
--- a/repo/includes/store/sql/SqlStore.php
+++ b/repo/includes/store/sql/SqlStore.php
@@ -680,8 +680,8 @@
* @return PropertyInfoStore
*/
private function newPropertyInfoStore() {
- $usePropertyInfoTable = WikibaseRepo::getDefaultInstance()->
- getSettings()->getSetting( 'usePropertyInfoTable' );
+ $wikibaseRepo = WikibaseRepo::getDefaultInstance();
+ $usePropertyInfoTable =
$wikibaseRepo->getSettings()->getSetting( 'usePropertyInfoTable' );
if ( $usePropertyInfoTable ) {
$table = new PropertyInfoTable( false );
--
To view, visit https://gerrit.wikimedia.org/r/212787
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iced9d822cb61312b9332a1ddffb113f2a0b52233
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits