[MediaWiki-commits] [Gerrit] Optimize all use sections in Client - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Optimize all use sections in Client .. Optimize all use sections in Client Change-Id: I6ab1d09a3e55ac7d8b25362c187969015ad1f68b --- M client/includes/DataAccess/PropertyIdResolver.php M client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php M client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php M client/includes/DataAccess/PropertyParserFunction/Runner.php M client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php M client/includes/DataAccess/PropertyParserFunction/VariantsAwareRenderer.php M client/includes/LangLinkHandler.php M client/includes/Usage/Sql/UsageTableUpdater.php M client/includes/WikibaseClient.php M client/includes/hooks/DataUpdateHookHandlers.php M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php M client/includes/scribunto/WikibaseLuaBindings.php M client/includes/store/ClientStore.php M client/includes/store/sql/DirectSqlStore.php M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactoryTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php M client/tests/phpunit/includes/LangLinkHandlerTest.php M client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php M client/tests/phpunit/includes/Usage/UsageAccumulatorContractTester.php M client/tests/phpunit/includes/Usage/UsageLookupContractTester.php M client/tests/phpunit/includes/Usage/UsageTrackerContractTester.php M client/tests/phpunit/includes/UsageUpdaterTest.php M client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php M client/tests/phpunit/includes/hooks/SidebarHookHandlersTest.php M client/tests/phpunit/includes/store/TitleFactoryTest.php 29 files changed, 40 insertions(+), 65 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/includes/DataAccess/PropertyIdResolver.php b/client/includes/DataAccess/PropertyIdResolver.php index 395377b..d4a77ed 100644 --- a/client/includes/DataAccess/PropertyIdResolver.php +++ b/client/includes/DataAccess/PropertyIdResolver.php @@ -3,8 +3,6 @@ namespace Wikibase\DataAccess; use InvalidArgumentException; -use Wikibase\DataModel\Entity\Entity; -use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\Lib\PropertyLabelNotResolvedException; use Wikibase\PropertyLabelResolver; diff --git a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php index 84fa3c6..8af6deb 100644 --- a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php +++ b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php @@ -5,10 +5,8 @@ use InvalidArgumentException; use Language; use Status; -use Wikibase\Client\WikibaseClient; +use Wikibase\Client\Usage\UsageAccumulator; use Wikibase\DataAccess\PropertyIdResolver; -use Wikibase\DataModel\Claim\Claims; -use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdValue; use Wikibase\DataModel\Entity\PropertyId; @@ -16,7 +14,6 @@ use Wikibase\DataModel\Snak\Snak; use Wikibase\Lib\PropertyLabelNotResolvedException; use Wikibase\Lib\SnakFormatter; -use Wikibase\Client\Usage\UsageAccumulator; /** * PropertyClaimsRenderer of the {{#property}} parser function. diff --git a/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php b/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php index ef2eccd..7afbdab 100644 --- a/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php +++ b/client/includes/DataAccess/PropertyParserFunction/PropertyClaimsRendererFactory.php @@ -5,12 +5,12 @@ use Language; use Parser; use ValueFormatters\FormatterOptions; +use Wikibase\Client\Usage\ParserOutputUsageAccumulator; +use Wikibase\Client\Usage\UsageAccumulator; use Wikibase\DataAccess\PropertyIdResolver; use Wikibase\LanguageFallbackChainFactory; use Wikibase\Lib\OutputFormatSnakFormatterFactory; use Wikibase\Lib\SnakFormatter; -use Wikibase\Client\Usage\ParserOutputUsageAccumulator; -use Wikibase\Client\Usage\UsageAccumulator; /** * @since 0.5 diff --git a/client/includes/DataAccess/PropertyParserFunction/Runner.php b/client/includes/DataAccess/PropertyParserFunction/Runner.php index 36f2947..978904a 100644 ---
[MediaWiki-commits] [Gerrit] inject SiteList in OtherProjectsSitesProvider instead of cal... - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: inject SiteList in OtherProjectsSitesProvider instead of calling getSites many times .. inject SiteList in OtherProjectsSitesProvider instead of calling getSites many times Change-Id: I8efd3cf1ea3d97835e43544d891d95487cb294fa --- M client/includes/OtherProjectsSitesProvider.php M client/includes/WikibaseClient.php M client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php 3 files changed, 12 insertions(+), 13 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/includes/OtherProjectsSitesProvider.php b/client/includes/OtherProjectsSitesProvider.php index 4c11a34..4068e2a 100644 --- a/client/includes/OtherProjectsSitesProvider.php +++ b/client/includes/OtherProjectsSitesProvider.php @@ -4,7 +4,6 @@ use Site; use SiteList; -use SiteStore; /** * Provides a list of sites that should be displayed in the other project sidebar @@ -18,9 +17,9 @@ class OtherProjectsSitesProvider { /** -* @param SiteStore $siteStore +* @param SiteList $sites */ - private $siteStore; + private $sites; /** * @var Site @@ -33,12 +32,12 @@ private $specialSiteGroups; /** -* @param SiteStore $siteStore +* @param SiteList $sites * @param Site $currentSite * @param string[] $specialSiteGroups */ - public function __construct( SiteStore $siteStore, Site $currentSite, array $specialSiteGroups ) { - $this-siteStore = $siteStore; + public function __construct( SiteList $sites, Site $currentSite, array $specialSiteGroups ) { + $this-sites = $sites; $this-currentSite = $currentSite; $this-specialSiteGroups = $specialSiteGroups; } @@ -100,7 +99,7 @@ * @return Site|null */ private function getSiteForGroup( $groupId ) { - $siteGroupList = $this-siteStore-getSites()-getGroup( $groupId ); + $siteGroupList = $this-sites-getGroup( $groupId ); if ( $siteGroupList-count() === 1 ) { return $siteGroupList[0]; } diff --git a/client/includes/WikibaseClient.php b/client/includes/WikibaseClient.php index ae30502..0e11503 100644 --- a/client/includes/WikibaseClient.php +++ b/client/includes/WikibaseClient.php @@ -717,7 +717,7 @@ */ public function getOtherProjectsSitesProvider() { return new OtherProjectsSitesProvider( - $this-getSiteStore(), + $this-getSiteStore()-getSites(), $this-getSite(), $this-getSettings()-getSetting( 'specialSiteLinkGroups' ) ); diff --git a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php index 79bdaef..4c32458 100644 --- a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php +++ b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php @@ -28,9 +28,9 @@ * @dataProvider otherProjectSitesProvider */ public function testOtherProjectSites( array $supportedSites, Site $inputSite, SiteList $expectedSites ) { - $siteStore = $this-getSiteStoreMock(); + $sites = $this-getSiteStoreMock()-getSites(); - $otherProjectsSitesProvider = new OtherProjectsSitesProvider( $siteStore, $inputSite, array( 'wikidata' ) ); + $otherProjectsSitesProvider = new OtherProjectsSitesProvider( $sites, $inputSite, array( 'wikidata' ) ); $this-assertEquals( $expectedSites, @@ -42,8 +42,8 @@ * @dataProvider otherProjectSitesProvider */ public function testOtherProjectSiteIds( array $supportedSites, Site $inputSite, SiteList $expectedSites ) { - $siteStore = $this-getSiteStoreMock(); - $otherProjectsSitesProvider = new OtherProjectsSitesProvider( $siteStore, $inputSite, array( 'wikidata' ) ); + $sites = $this-getSiteStoreMock()-getSites(); + $otherProjectsSitesProvider = new OtherProjectsSitesProvider( $sites, $inputSite, array( 'wikidata' ) ); $expectedSiteIds = array(); foreach ( $expectedSites as $site ) { @@ -172,4 +172,4 @@ return new MockSiteStore( $sites ); } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/173242 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8efd3cf1ea3d97835e43544d891d95487cb294fa Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com
[MediaWiki-commits] [Gerrit] Empty the default ID blacklist - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/172504 Change subject: Empty the default ID blacklist .. Empty the default ID blacklist Change-Id: Iaf12e09290be6a3a37cec012e70678b4b456d15d --- M repo/config/Wikibase.default.php 1 file changed, 0 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/04/172504/1 diff --git a/repo/config/Wikibase.default.php b/repo/config/Wikibase.default.php index 1eb1e3d..4c94830 100644 --- a/repo/config/Wikibase.default.php +++ b/repo/config/Wikibase.default.php @@ -18,13 +18,6 @@ $defaults = array( 'idBlacklist' = array( - 1, - 23, - 42, - 1337, - 9001, - 31337, - 720101010, ), // Allow the TermIndex table to work without the term_search_key field, -- To view, visit https://gerrit.wikimedia.org/r/172504 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaf12e09290be6a3a37cec012e70678b4b456d15d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use __DIR__ instead of dirname( __FILE__ ) - change (mediawiki...Nuke)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Use __DIR__ instead of dirname( __FILE__ ) .. Use __DIR__ instead of dirname( __FILE__ ) Change-Id: Ibd0f9c9baf52d9962ab3fcbfe31e04028aed699c --- M Nuke.i18n.php M Nuke.php M SpecialNuke.php 3 files changed, 4 insertions(+), 4 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/Nuke.i18n.php b/Nuke.i18n.php index a01e3a8..1aded8a 100644 --- a/Nuke.i18n.php +++ b/Nuke.i18n.php @@ -15,7 +15,7 @@ function wfJsonI18nShim1b110e87fcd3a9cb( $cache, $code, $cachedData ) { $codeSequence = array_merge( array( $code ), $cachedData['fallbackSequence'] ); foreach ( $codeSequence as $csCode ) { - $fileName = dirname( __FILE__ ) . /i18n/$csCode.json; + $fileName = __DIR__ . /i18n/$csCode.json; if ( is_readable( $fileName ) ) { $data = FormatJson::decode( file_get_contents( $fileName ), true ); foreach ( array_keys( $data ) as $key ) { diff --git a/Nuke.php b/Nuke.php index 12022f2..14f45a3 100644 --- a/Nuke.php +++ b/Nuke.php @@ -6,7 +6,7 @@ define( 'Nuke_VERSION', '1.2.0' ); -$dir = dirname( __FILE__ ) . '/'; +$dir = __DIR__ . '/'; $wgMessagesDirs['Nuke'] = __DIR__ . '/i18n'; $wgExtensionMessagesFiles['Nuke'] = $dir . 'Nuke.i18n.php'; @@ -33,7 +33,7 @@ // Resource loader modules $moduleTemplate = array( - 'localBasePath' = dirname( __FILE__ ) . '/', + 'localBasePath' = __DIR__ . '/', 'remoteExtPath' = 'Nuke/' ); diff --git a/SpecialNuke.php b/SpecialNuke.php index 99fe994..3a8408a 100644 --- a/SpecialNuke.php +++ b/SpecialNuke.php @@ -1,2 +1,2 @@ ?php -require_once( dirname( __FILE__ ) . '/Nuke.php' ); +require_once( __DIR__ . '/Nuke.php' ); -- To view, visit https://gerrit.wikimedia.org/r/172029 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibd0f9c9baf52d9962ab3fcbfe31e04028aed699c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Nuke Gerrit-Branch: master Gerrit-Owner: Southparkfan southparkfan...@hotmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Siebrand siebr...@kitano.nl Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove usage of deprecated Entity methods - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/171845 Change subject: Remove usage of deprecated Entity methods .. Remove usage of deprecated Entity methods Two issues remain in this code: * Code only works with items and properties (this is now explicit, while before it would just break for entities with statements). This is the issue described in https://lists.wikimedia.org/pipermail/wikidata-tech/2014-June/000489.html And can be fixed as follows https://lists.wikimedia.org/pipermail/wikidata-tech/2014-August/000546.html * The deprecated Claims class is still used. This forces transformation from StatementList to Claims to StatementList, which is a waste of resources. Change-Id: I37843beca7de1a629c3da392644a8abe21866473 --- M repo/includes/ChangeOp/ChangeOpClaimRemove.php 1 file changed, 12 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/45/171845/1 diff --git a/repo/includes/ChangeOp/ChangeOpClaimRemove.php b/repo/includes/ChangeOp/ChangeOpClaimRemove.php index 6084a14..ddc2d53 100644 --- a/repo/includes/ChangeOp/ChangeOpClaimRemove.php +++ b/repo/includes/ChangeOp/ChangeOpClaimRemove.php @@ -6,7 +6,11 @@ use ValueValidators\Result; use Wikibase\DataModel\Claim\Claims; use Wikibase\DataModel\Entity\Entity; +use Wikibase\DataModel\Entity\Item; +use Wikibase\DataModel\Entity\Property; +use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Snak\Snak; +use Wikibase\DataModel\Statement\StatementList; use Wikibase\Summary; /** @@ -53,11 +57,14 @@ * @see ChangeOp::apply() */ public function apply( Entity $entity, Summary $summary = null ) { - $claims = new Claims( $entity-getClaims() ); - - $this-removeClaim( $claims, $summary ); - - $entity-setClaims( $claims ); + if ( $entity instanceof Item || $entity instanceof Property ) { + $claims = new Claims( $entity-getStatements() ); + $this-removeClaim( $claims, $summary ); + $entity-setStatements( new StatementList( $claims ) ); + } + else { + throw new InvalidArgumentException( 'This code only works with items and properties' ); + } return true; } -- To view, visit https://gerrit.wikimedia.org/r/171845 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I37843beca7de1a629c3da392644a8abe21866473 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add @group Database to ApiXmlFormatTest - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Add @group Database to ApiXmlFormatTest .. Add @group Database to ApiXmlFormatTest Change-Id: Id57690a49e01af0ed0b9ae7580cf0c4505488aab --- M repo/tests/phpunit/includes/api/ApiXmlFormatTest.php 1 file changed, 2 insertions(+), 1 deletion(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php index 77a01a7..6071a25 100644 --- a/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php +++ b/repo/tests/phpunit/includes/api/ApiXmlFormatTest.php @@ -19,12 +19,13 @@ * @group Wikibase * @group WikibaseAPI * @group WikibaseRepo + * @group Database * @group medium * * @licence GNU GPL v2+ * @author Katie Filbert aude.w...@gmail.com */ -class ApiXmlFormatTest extends \PHPUnit_Framework_TestCase { +class ApiXmlFormatTest extends \MediaWikiTestCase { /** * @var EntityRevision -- To view, visit https://gerrit.wikimedia.org/r/171849 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id57690a49e01af0ed0b9ae7580cf0c4505488aab Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add package definitions for each component - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/171481 Change subject: Add package definitions for each component .. Add package definitions for each component Change-Id: Iec30bfa93ebf77453e571a42ea7f579bf0e640b3 --- A client/composer.json A lib/composer.json A repo/composer.json 3 files changed, 171 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/81/171481/1 diff --git a/client/composer.json b/client/composer.json new file mode 100644 index 000..ee43f63 --- /dev/null +++ b/client/composer.json @@ -0,0 +1,58 @@ +{ + name: mediawiki/wikibase-client, + type: mediawiki-extension, + description: MediaWiki extension that lets you retrieve and embed structured data from a Wikibase repository into your wiki, + keywords: [ + wikibase, + wikidata, + client + ], + homepage: http://wikiba.se;, + license: GNU GPL v2+, + authors: [ + { + name: The Wikidata team + } + ], + support: { + irc: irc://irc.freenode.net/wikidata + }, + require: { + php: =5.3.2, + + data-values/data-values: ~0.1.0, + data-values/common: ~0.2.0, + data-values/geo: ~1.0.0, + data-values/interfaces: ~0.1.4, + data-values/number: ~0.4.0, + data-values/time: ~0.6.0, + data-values/validators: ~0.1.0, + data-values/data-types: ~0.4.0, + data-values/serialization: ~1.0, + data-values/javascript: ~0.6.0, + data-values/value-view: ~0.7.0, + + wikibase/data-model: ~2.0, + wikibase/data-model-javascript: ~0.3.0, + wikibase/data-model-serialization: ~1.2, + wikibase/internal-serialization: ~1.3, + wikibase/serialization-javascript: ~1.1.1, + + diff/diff: ~1.0, + + mediawiki/wikibase-lib: @dev + }, + autoload: { + files : [ + WikibaseClient.php + ], + classmap: [ + includes/, + WikibaseClient.hooks.php, + tests/phpunit/MockPageUpdater.php, + tests/phpunit/MockClientStore.php, + tests/phpunit/includes/scribunto/WikibaseLuaIntegrationTestItemSetUpHelper.php, + tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php + ] + } +} diff --git a/lib/composer.json b/lib/composer.json new file mode 100644 index 000..cd49662 --- /dev/null +++ b/lib/composer.json @@ -0,0 +1,53 @@ +{ + name: mediawiki/wikibase-lib, + type: mediawiki-extension, + description: MediaWiki extension with utilities for Wikibase extensions, + keywords: [ + wikibase, + wikidata, + lib + ], + homepage: http://wikiba.se;, + license: GNU GPL v2+, + authors: [ + { + name: The Wikidata team + } + ], + support: { + irc: irc://irc.freenode.net/wikidata + }, + require: { + php: =5.3.2, + + data-values/data-values: ~0.1.0, + data-values/common: ~0.2.0, + data-values/geo: ~1.0.0, + data-values/interfaces: ~0.1.4, + data-values/number: ~0.4.0, + data-values/time: ~0.6.0, + data-values/validators: ~0.1.0, + data-values/data-types: ~0.4.0, + data-values/serialization: ~1.0, + data-values/javascript: ~0.6.0, + data-values/value-view: ~0.7.0, + + wikibase/data-model: ~2.0, + wikibase/data-model-javascript: ~0.3.0, + wikibase/data-model-serialization: ~1.2, + wikibase/internal-serialization: ~1.3, + wikibase/serialization-javascript: ~1.1.1, + + diff/diff: ~1.0 + }, + autoload: { + files : [ + WikibaseLib.php + ], + classmap: [ + includes/, + WikibaseLib.hooks.php, + tests/phpunit/ + ] + } +} diff --git a/repo/composer.json b/repo/composer.json new file mode 100644 index 000..55515ac --- /dev/null +++ b/repo/composer.json @@ -0,0 +1,60 @@ +{ + name: mediawiki/wikibase-repository, + type: mediawiki-extension, + description: MediaWiki extension that lets you store and collaboratively manage structured data, + keywords: [ +
[MediaWiki-commits] [Gerrit] Fix comment in ApiErrorReporter - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix comment in ApiErrorReporter .. Fix comment in ApiErrorReporter Change-Id: I8cf3c87c3f49bf8c37ab86e70f4ec01b8ad01531 --- M repo/includes/api/ApiErrorReporter.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/api/ApiErrorReporter.php b/repo/includes/api/ApiErrorReporter.php index bbace38..38735db 100644 --- a/repo/includes/api/ApiErrorReporter.php +++ b/repo/includes/api/ApiErrorReporter.php @@ -209,7 +209,7 @@ * replacement for ApiBase::dieUsage(). * * Localization of the error code is attempted by looking up a message key -* constructed using the given code in wikibase-error-$errorCode. If such a message +* constructed using the given code in wikibase-api-$errorCode. If such a message * exists, it is included in the error's extra data. * * @see ApiBase::dieUsage() -- To view, visit https://gerrit.wikimedia.org/r/171250 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8cf3c87c3f49bf8c37ab86e70f4ec01b8ad01531 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Add getPermissionForTitle method to use in ViewEntityAction - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Add getPermissionForTitle method to use in ViewEntityAction .. Add getPermissionForTitle method to use in ViewEntityAction Change-Id: Ia56f00ffc1338ab1320e5b38446240b3ee360519 --- M repo/includes/actions/ViewEntityAction.php M repo/includes/content/EntityContentFactory.php M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php 3 files changed, 52 insertions(+), 13 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/actions/ViewEntityAction.php b/repo/includes/actions/ViewEntityAction.php index 11af1a3..e814904 100644 --- a/repo/includes/actions/ViewEntityAction.php +++ b/repo/includes/actions/ViewEntityAction.php @@ -163,13 +163,12 @@ if ( $editable !$content-isRedirect() ) { $permissionChecker = $this-getPermissionChecker(); - $permissionStatus = $permissionChecker-getPermissionStatusForEntity( + $editable = $permissionChecker-getPermissionForTitle( + $this-getArticle()-getTitle(), + $content, $this-getUser(), - 'edit', - $content-getEntity(), - 'quick' ); - - $editable = $permissionStatus-isOK(); + 'edit' + ); } $parserOptions = $this-getArticle()-getPage()-makeParserOptions( $this-getContext()-getUser() ); diff --git a/repo/includes/content/EntityContentFactory.php b/repo/includes/content/EntityContentFactory.php index 218c43a..b130d67 100644 --- a/repo/includes/content/EntityContentFactory.php +++ b/repo/includes/content/EntityContentFactory.php @@ -11,6 +11,7 @@ use User; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; +use Wikibase\EntityContent; use Wikibase\Lib\Store\EntityRedirect; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Repo\Store\EntityPermissionChecker; @@ -189,23 +190,32 @@ } /** -* @see EntityPermissionChecker::getPermissionStatusForEntityId -* * @param User $user * @param string $permission * @param Title $entityPage * @param string $quick * -* @return Status a status object representing the check's result. -* +* //XXX: would be nice to be able to pass the $short flag too, +*as used by getUserPermissionsErrorsInternal. But Title doesn't expose that. * @todo Move to a separate service (merge into WikiPageEntityStore?) +* +* @return Status a status object representing the check's result. */ protected function getPermissionStatus( User $user, $permission, Title $entityPage, $quick = '' ) { wfProfileIn( __METHOD__ ); - - //XXX: would be nice to be able to pass the $short flag too, - // as used by getUserPermissionsErrorsInternal. But Title doesn't expose that. $errors = $entityPage-getUserPermissionsErrors( $permission, $user, $quick !== 'quick' ); + $status = $this-getStatusForPermissionErrors( $errors ); + + wfProfileOut( __METHOD__ ); + return $status; + } + + /** +* @param string[] $errors +* +* @return Status +*/ + protected function getStatusForPermissionErrors( array $errors ) { $status = Status::newGood(); foreach ( $errors as $error ) { @@ -301,4 +311,25 @@ return $status; } + /** +* @param Title $title +* @param EntityContent $content +* @param User $user +* @param string $permission +* +* @return boolean +*/ + public function getPermissionForTitle( Title $title, EntityContent $content, User $user, $permission ) { + $entityContentTitle = $this-getTitleForId( $content-getEntity()-getId() ); + + if ( $entityContentTitle-getFullText() !== $title-getFullText() ) { + throw new MWException( '$title does not match content' ); + } + + $errors = $title-getUserPermissionsErrors( $permission, $user, 'quick' ); + $permissionStatus = $this-getStatusForPermissionErrors( $errors ); + + return $permissionStatus-isOK(); + } + } diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php index 460cb3f..e18755a 100644 --- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php +++
[MediaWiki-commits] [Gerrit] Adjust getPermissionForTitle method to getEditPermissionForT... - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Adjust getPermissionForTitle method to getEditPermissionForTitle .. Adjust getPermissionForTitle method to getEditPermissionForTitle Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002 --- M repo/includes/actions/ViewEntityAction.php M repo/includes/content/EntityContentFactory.php M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php 3 files changed, 6 insertions(+), 8 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/actions/ViewEntityAction.php b/repo/includes/actions/ViewEntityAction.php index e814904..d65e40c 100644 --- a/repo/includes/actions/ViewEntityAction.php +++ b/repo/includes/actions/ViewEntityAction.php @@ -163,11 +163,10 @@ if ( $editable !$content-isRedirect() ) { $permissionChecker = $this-getPermissionChecker(); - $editable = $permissionChecker-getPermissionForTitle( + $editable = $permissionChecker-getEditPermissionForTitle( $this-getArticle()-getTitle(), $content, - $this-getUser(), - 'edit' + $this-getUser() ); } diff --git a/repo/includes/content/EntityContentFactory.php b/repo/includes/content/EntityContentFactory.php index b130d67..aefe580 100644 --- a/repo/includes/content/EntityContentFactory.php +++ b/repo/includes/content/EntityContentFactory.php @@ -315,18 +315,17 @@ * @param Title $title * @param EntityContent $content * @param User $user -* @param string $permission * * @return boolean */ - public function getPermissionForTitle( Title $title, EntityContent $content, User $user, $permission ) { + public function getEditPermissionForTitle( Title $title, EntityContent $content, User $user ) { $entityContentTitle = $this-getTitleForId( $content-getEntity()-getId() ); if ( $entityContentTitle-getFullText() !== $title-getFullText() ) { throw new MWException( '$title does not match content' ); } - $errors = $title-getUserPermissionsErrors( $permission, $user, 'quick' ); + $errors = $title-getUserPermissionsErrors( 'edit', $user, 'quick' ); $permissionStatus = $this-getStatusForPermissionErrors( $errors ); return $permissionStatus-isOK(); diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php index e18755a..40f4c2b 100644 --- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php +++ b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php @@ -151,7 +151,7 @@ 'getPermissionStatusForEntity' = true, 'getPermissionStatusForEntityType' = true, 'getPermissionStatusForEntityId' = true, - 'getPermissionForTitle' = true, + 'getEditPermissionForTitle' = true, ), ), 'edit not allowed' = array( @@ -162,7 +162,7 @@ 'getPermissionStatusForEntity' = false, 'getPermissionStatusForEntityType' = false, 'getPermissionStatusForEntityId' = false, - 'getPermissionForTitle' = false, + 'getEditPermissionForTitle' = false, ), ), 'delete not allowed' = array( -- To view, visit https://gerrit.wikimedia.org/r/170693 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I4a376dcc14f195c86cae20ebdd00719c437c7002 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use Title::quickUserCan in EntityPermissionChecker - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Use Title::quickUserCan in EntityPermissionChecker .. Use Title::quickUserCan in EntityPermissionChecker Change-Id: If3b94a329ed51c2881f383356d5f7d58bfa7da32 --- M repo/includes/actions/ViewEntityAction.php M repo/includes/content/EntityContentFactory.php M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php 3 files changed, 4 insertions(+), 65 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/actions/ViewEntityAction.php b/repo/includes/actions/ViewEntityAction.php index d65e40c..5dccc08 100644 --- a/repo/includes/actions/ViewEntityAction.php +++ b/repo/includes/actions/ViewEntityAction.php @@ -9,7 +9,6 @@ use SpecialPage; use ViewAction; use Wikibase\Repo\Content\EntityHandler; -use Wikibase\Repo\Store\EntityPermissionChecker; use Wikibase\Repo\WikibaseRepo; /** @@ -27,11 +26,6 @@ * @var LanguageFallbackChain */ protected $languageFallbackChain; - - /** -* @var EntityPermissionChecker -*/ - protected $permissionChecker; /** * Get the language fallback chain. @@ -59,29 +53,6 @@ */ public function setLanguageFallbackChain( LanguageFallbackChain $chain ) { $this-languageFallbackChain = $chain; - } - - /** -* Get permission checker. -* Uses the default WikibaseRepo instance to get the service if it was not previously set. -* -* @return EntityPermissionChecker -*/ - public function getPermissionChecker() { - if ( $this-permissionChecker === null ) { - $this-permissionChecker = WikibaseRepo::getDefaultInstance()-getEntityPermissionChecker(); - } - - return $this-permissionChecker; - } - - /** -* Set permission checker. -* -* @param EntityPermissionChecker $permissionChecker -*/ - public function setPermissionChecker( EntityPermissionChecker $permissionChecker ) { - $this-permissionChecker = $permissionChecker; } /** @@ -161,16 +132,13 @@ // NOTE: page-wide property, independent of user permissions $outputPage-addJsConfigVars( 'wbIsEditView', $editable ); + $user = $this-getContext()-getUser(); + if ( $editable !$content-isRedirect() ) { - $permissionChecker = $this-getPermissionChecker(); - $editable = $permissionChecker-getEditPermissionForTitle( - $this-getArticle()-getTitle(), - $content, - $this-getUser() - ); + $editable = $this-getArticle()-getTitle()-quickUserCan( 'edit', $user ); } - $parserOptions = $this-getArticle()-getPage()-makeParserOptions( $this-getContext()-getUser() ); + $parserOptions = $this-getArticle()-getPage()-makeParserOptions( $user ); if ( !$editable ) { // disable editing features (sections is a misnomer, it applies to the wikitext equivalent) diff --git a/repo/includes/content/EntityContentFactory.php b/repo/includes/content/EntityContentFactory.php index aefe580..1bc4454 100644 --- a/repo/includes/content/EntityContentFactory.php +++ b/repo/includes/content/EntityContentFactory.php @@ -311,24 +311,4 @@ return $status; } - /** -* @param Title $title -* @param EntityContent $content -* @param User $user -* -* @return boolean -*/ - public function getEditPermissionForTitle( Title $title, EntityContent $content, User $user ) { - $entityContentTitle = $this-getTitleForId( $content-getEntity()-getId() ); - - if ( $entityContentTitle-getFullText() !== $title-getFullText() ) { - throw new MWException( '$title does not match content' ); - } - - $errors = $title-getUserPermissionsErrors( 'edit', $user, 'quick' ); - $permissionStatus = $this-getStatusForPermissionErrors( $errors ); - - return $permissionStatus-isOK(); - } - } diff --git a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php index 40f4c2b..460cb3f 100644 --- a/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php +++ b/repo/tests/phpunit/includes/content/EntityContentFactoryTest.php @@ -151,7 +151,6 @@ 'getPermissionStatusForEntity' = true, 'getPermissionStatusForEntityType' = true,
[MediaWiki-commits] [Gerrit] Remove $parserOptions-setEditSection code in ViewEntityAction - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove $parserOptions-setEditSection code in ViewEntityAction .. Remove $parserOptions-setEditSection code in ViewEntityAction This is already done in Article::view (on line 535), which is called by ViewEntityAction in displayEntityContent method. Change-Id: I5d27958ff46ac91f8ccc6f68eb6c9ff68ff24c3e --- M repo/includes/actions/ViewEntityAction.php 1 file changed, 0 insertions(+), 10 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/actions/ViewEntityAction.php b/repo/includes/actions/ViewEntityAction.php index 5dccc08..a90b437 100644 --- a/repo/includes/actions/ViewEntityAction.php +++ b/repo/includes/actions/ViewEntityAction.php @@ -133,17 +133,7 @@ $outputPage-addJsConfigVars( 'wbIsEditView', $editable ); $user = $this-getContext()-getUser(); - - if ( $editable !$content-isRedirect() ) { - $editable = $this-getArticle()-getTitle()-quickUserCan( 'edit', $user ); - } - $parserOptions = $this-getArticle()-getPage()-makeParserOptions( $user ); - - if ( !$editable ) { - // disable editing features (sections is a misnomer, it applies to the wikitext equivalent) - $parserOptions-setEditSection( $editable ); - } $this-getArticle()-setParserOptions( $parserOptions ); $this-getArticle()-view(); -- To view, visit https://gerrit.wikimedia.org/r/170695 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5d27958ff46ac91f8ccc6f68eb6c9ff68ff24c3e Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unused mw reference in RepoApi, expand alias - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove unused mw reference in RepoApi, expand alias .. Remove unused mw reference in RepoApi, expand alias Change-Id: I2358da92546829d42435577ca792fedd089bea0d --- M lib/resources/wikibase.RepoApi/wikibase.RepoApi.js 1 file changed, 6 insertions(+), 6 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js index ca9248b..c079bea 100644 --- a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js +++ b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js @@ -5,7 +5,7 @@ * @author H. Snater mediaw...@snater.com * @author Marius Hoch h...@online.de */ -( function( mw, wb, $ ) { +( function( wb, $ ) { 'use strict'; /** @@ -14,7 +14,7 @@ * @since 0.5 (in 0.4 without constructor parameters, in 0.3 as wb.Api without support for client *usage) * - * @param {mw.Api} api + * @param {mediaWiki.Api} api * * @throws {Error} if parameters are not specified properly. */ @@ -28,7 +28,7 @@ $.extend( wb.RepoApi.prototype, { /** -* @type mw.Api +* @type mediaWiki.Api */ _api: null, @@ -509,7 +509,7 @@ * Submits the AJAX request to the API of the repo and triggers on the response. This will * automatically add the required 'token' information for editing into the given parameters * sent to the API. -* @see mw.Api.post +* @see mediaWiki.Api.post * * @param {Object} params parameters for the API call * @return {jQuery.Promise} @@ -536,7 +536,7 @@ /** * Performs an API get request. -* @see mw.Api.get +* @see mediaWiki.Api.get * @since 0.3 * * @param {Object} params @@ -552,4 +552,4 @@ } } ); -}( mediaWiki, wikibase, jQuery ) ); +}( wikibase, jQuery ) ); -- To view, visit https://gerrit.wikimedia.org/r/170930 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2358da92546829d42435577ca792fedd089bea0d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Much more clean up in SqlUsageTracker - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Much more clean up in SqlUsageTracker .. Much more clean up in SqlUsageTracker Oh wow, this was confusing. Sorry to say that. Some $entityIds contained actual EntityId objects, others strings. An $entities array should always contain Entity objects, not something else. Change-Id: I360124c8df1896896c1183fe8567e6d5d979eb08 --- M client/includes/Usage/Sql/SqlUsageTracker.php M client/includes/Usage/Sql/UsageTableUpdater.php M client/includes/Usage/UsageLookup.php M client/tests/phpunit/includes/Usage/UsageLookupContractTester.php M repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php 5 files changed, 73 insertions(+), 85 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/includes/Usage/Sql/SqlUsageTracker.php b/client/includes/Usage/Sql/SqlUsageTracker.php index 701ccad..35eec2a 100644 --- a/client/includes/Usage/Sql/SqlUsageTracker.php +++ b/client/includes/Usage/Sql/SqlUsageTracker.php @@ -8,7 +8,6 @@ use Exception; use InvalidArgumentException; use Iterator; -use LoadBalancer; use Wikibase\Client\Store\Sql\ConnectionManager; use Wikibase\Client\Usage\EntityUsage; use Wikibase\Client\Usage\UsageLookup; @@ -24,11 +23,6 @@ * @author Daniel Kinzler */ class SqlUsageTracker implements UsageTracker, UsageLookup { - - /** -* @var string -*/ - private $tableName; /** * @var EntityIdParser @@ -47,10 +41,9 @@ /** * @param EntityIdParser $idParser -* @param LoadBalancer $loadBalancer +* @param ConnectionManager $connectionManager */ public function __construct( EntityIdParser $idParser, ConnectionManager $connectionManager ) { - $this-tableName = 'wbc_entity_usage'; $this-idParser = $idParser; $this-connectionManager = $connectionManager; } @@ -61,7 +54,7 @@ * @return UsageTableUpdater */ private function newTableUpdater( DatabaseBase $db ) { - return new UsageTableUpdater( $db, $this-tableName, $this-batchSize ); + return new UsageTableUpdater( $db, 'wbc_entity_usage', $this-batchSize ); } /** @@ -83,13 +76,14 @@ } /** -* Returns the string serialization of an EntityId. +* @param EntityId[] $entityIds * -* @param EntityId $entityId -* @return string +* @return string[] */ - private function getEntityIdSerialization( EntityId $entityId ) { - return $entityId-getSerialization(); + private function getEntityIdStrings( array $entityIds ) { + return array_map( function( EntityId $entityId ) { + return $entityId-getSerialization(); + }, $entityIds ); } /** @@ -100,6 +94,7 @@ * * @throws InvalidArgumentException * @throws UsageTrackerException +* @throws Exception * @return EntityUsage[] Usages before the update, in the same form as $usages */ public function trackUsedEntities( $pageId, array $usages ) { @@ -110,13 +105,13 @@ $db = $this-connectionManager-beginAtomicSection( __METHOD__ ); try { - $oldUsage = $this-queryUsageForPage( $db, $pageId ); + $oldUsages = $this-queryUsagesForPage( $db, $pageId ); $tableUpdater = $this-newTableUpdater( $db ); - $tableUpdater-updateUsage( $pageId, $oldUsage, $usages ); + $tableUpdater-updateUsage( $pageId, $oldUsages, $usages ); $this-connectionManager-commitAtomicSection( $db, __METHOD__ ); - return $oldUsage; + return $oldUsages; } catch ( Exception $ex ) { $this-connectionManager-rollbackAtomicSection( $db, __METHOD__ ); @@ -131,22 +126,23 @@ /** * @see UsageTracker::removeEntities * -* @param EntityId[] $entities +* @param EntityId[] $entityIds * * @throws UsageTrackerException +* @throws Exception */ - public function removeEntities( array $entities ) { - if ( empty( $entities ) ) { + public function removeEntities( array $entityIds ) { + if ( empty( $entityIds ) ) { return; } - $entityIds = array_map( array( $this, 'getEntityIdSerialization' ), $entities ); + $idStrings = $this-getEntityIdStrings( $entityIds ); $db = $this-connectionManager-beginAtomicSection( __METHOD__ ); try { $tableUpdater =
[MediaWiki-commits] [Gerrit] Remove bad dependency from NoBadDependencyUsageTest - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/169360 Change subject: Remove bad dependency from NoBadDependencyUsageTest .. Remove bad dependency from NoBadDependencyUsageTest Much irony Change-Id: I3e851aadde8e6e21066f38d979ddd61d6925f928 --- M lib/tests/phpunit/NoBadDependencyUsageTest.php 1 file changed, 0 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/60/169360/1 diff --git a/lib/tests/phpunit/NoBadDependencyUsageTest.php b/lib/tests/phpunit/NoBadDependencyUsageTest.php index b33e3d0..d0ec71c 100644 --- a/lib/tests/phpunit/NoBadDependencyUsageTest.php +++ b/lib/tests/phpunit/NoBadDependencyUsageTest.php @@ -26,31 +26,10 @@ $this-assertStringNotInLib( 'Wikibase\\Client\\', 3 ); } - public function testNoSettingsUsageOutsideLib() { - // Increasing this allowance is forbidden - $this-assertStringNotInRepo( 'Settings::', 1 ); - $this-assertStringNotInClient( 'Settings::', 1 ); - } - private function assertStringNotInLib( $string, $maxAllowance ) { $this-assertStringNotInDir( $string, __DIR__ . '/../../', - $maxAllowance - ); - } - private function assertStringNotInClient( $string, $maxAllowance ) { - $this-assertStringNotInDir( - $string, - __DIR__ . '/../../../client/', - $maxAllowance - ); - } - - private function assertStringNotInRepo( $string, $maxAllowance ) { - $this-assertStringNotInDir( - $string, - __DIR__ . '/../../../repo/', $maxAllowance ); } -- To view, visit https://gerrit.wikimedia.org/r/169360 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e851aadde8e6e21066f38d979ddd61d6925f928 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Inject configured mwApi into RepoApi - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Inject configured mwApi into RepoApi .. Inject configured mwApi into RepoApi Change-Id: Ibae5bfca6f5d3b72257a5a97ecaf19b01ed42a15 --- M client/resources/jquery.wikibase/jquery.wikibase.linkitem.js M lib/resources/wikibase.RepoApi/resources.php M lib/resources/wikibase.RepoApi/wikibase.RepoApi.js M lib/tests/qunit/jquery.wikibase/jquery.wikibase.claimview.tests.js M lib/tests/qunit/jquery.wikibase/jquery.wikibase.referenceview.tests.js M lib/tests/qunit/resources.php M lib/tests/qunit/wikibase.RepoApi/wikibase.RepoApi.tests.js M repo/resources/Resources.php M repo/resources/wikibase.ui.entityViewInit.js 9 files changed, 29 insertions(+), 20 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/resources/jquery.wikibase/jquery.wikibase.linkitem.js b/client/resources/jquery.wikibase/jquery.wikibase.linkitem.js index 746edef..39b5aeb 100644 --- a/client/resources/jquery.wikibase/jquery.wikibase.linkitem.js +++ b/client/resources/jquery.wikibase/jquery.wikibase.linkitem.js @@ -347,7 +347,7 @@ this.targetArticle = $( '#wbclient-linkItem-page' ).val(); this._pageConnector = new wb.PageConnector( - new wb.RepoApi(), + new wb.RepoApi( this._mwApiForRepo ), this.options.globalSiteId, this.options.pageTitle, this.targetSite, diff --git a/lib/resources/wikibase.RepoApi/resources.php b/lib/resources/wikibase.RepoApi/resources.php index adc3e24..4831406 100644 --- a/lib/resources/wikibase.RepoApi/resources.php +++ b/lib/resources/wikibase.RepoApi/resources.php @@ -33,9 +33,7 @@ ), 'dependencies' = array( 'json', - 'mw.config.values.wbRepo', 'wikibase', - 'wikibase.api.getLocationAgnosticMwApi', ), ), diff --git a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js index f501b31..ca9248b 100644 --- a/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js +++ b/lib/resources/wikibase.RepoApi/wikibase.RepoApi.js @@ -8,25 +8,29 @@ ( function( mw, wb, $ ) { 'use strict'; -var repoConfig = mw.config.get( 'wbRepo' ); -var repoApiEndpoint = repoConfig.url + repoConfig.scriptPath + '/api.php'; -var mwApi = wb.api.getLocationAgnosticMwApi( repoApiEndpoint ); - /** * Constructor to create an API object for interaction with the repo Wikibase API. * @constructor - * @since 0.4 (since 0.3 as wb.Api without support for client usage) + * @since 0.5 (in 0.4 without constructor parameters, in 0.3 as wb.Api without support for client + *usage) + * + * @param {mw.Api} api + * + * @throws {Error} if parameters are not specified properly. */ -wb.RepoApi = function wbRepoApi() { +wb.RepoApi = function wbRepoApi( api ) { + if( api === undefined ) { + throw new Error( 'Required parameters not specified properly' ); + } + + this._api = api; }; $.extend( wb.RepoApi.prototype, { /** -* mediaWiki.Api object for internal usage. By having this initialized in the prototype, we can -* share one instance for all instances of the wikibase API. * @type mw.Api */ - _api: mwApi, + _api: null, /** * Creates a new entity with the given type and data. diff --git a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.claimview.tests.js b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.claimview.tests.js index e64246e..79954b9 100644 --- a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.claimview.tests.js +++ b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.claimview.tests.js @@ -30,7 +30,7 @@ value: value || null, entityStore: entityStore, valueViewBuilder: valueViewBuilder, - api: new wb.AbstractedRepoApi( new wb.RepoApi() ) + api: new wb.AbstractedRepoApi( new mw.Api() ) }; return $( 'div/' ) diff --git a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.referenceview.tests.js b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.referenceview.tests.js index 6c8ed81..13f3017 100644 --- a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.referenceview.tests.js +++ b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.referenceview.tests.js @@ -38,7 +38,7 @@ statementGuid: statementGuid, entityStore: entityStore, valueViewBuilder: valueViewBuilder, - api: new wb.AbstractedRepoApi( new wb.RepoApi() ) +
[MediaWiki-commits] [Gerrit] Don't use full qualified class names if not necesarry - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Don't use full qualified class names if not necesarry .. Don't use full qualified class names if not necesarry Found with PHPStorms static code analysis. Change-Id: I99bfc9e10e92962ecc5c4fd909a35d1d8094c051 --- M repo/includes/api/SearchEntities.php M repo/includes/specials/SpecialDispatchStats.php M repo/includes/specials/SpecialEntitiesWithoutDescription.php M repo/includes/specials/SpecialEntitiesWithoutLabel.php M repo/tests/phpunit/includes/UserLanguageLookupDouble.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php 6 files changed, 28 insertions(+), 16 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/api/SearchEntities.php b/repo/includes/api/SearchEntities.php index bca192b..253ea57 100644 --- a/repo/includes/api/SearchEntities.php +++ b/repo/includes/api/SearchEntities.php @@ -77,13 +77,13 @@ $ids = WikibaseRepo::getDefaultInstance()-getStore()-getTermIndex()-getMatchingIDs( array( - new \Wikibase\Term( array( - 'termType' = \Wikibase\Term::TYPE_LABEL, + new Term( array( + 'termType' = Term::TYPE_LABEL, 'termLanguage' = $language, 'termText' = $term ) ), - new \Wikibase\Term( array( - 'termType' = \Wikibase\Term::TYPE_ALIAS, + new Term( array( + 'termType' = Term::TYPE_ALIAS, 'termLanguage' = $language, 'termText' = $term ) ) @@ -322,7 +322,7 @@ } /** -* @see \ApiBase::getAllowedParams +* @see ApiBase::getAllowedParams */ public function getAllowedParams() { return array( @@ -354,7 +354,7 @@ } /** -* @see \ApiBase::getParamDescription +* @see ApiBase::getParamDescription */ public function getParamDescription() { return array( @@ -367,7 +367,7 @@ } /** -* @see \ApiBase::getDescription +* @see ApiBase::getDescription */ public function getDescription() { return array( @@ -376,7 +376,7 @@ } /** -* @see \ApiBase::getExamples +* @see ApiBase::getExamples */ protected function getExamples() { return array( @@ -387,7 +387,7 @@ } /** -* @see \ApiBase::getVersion +* @see ApiBase::getVersion */ public function getVersion() { return __CLASS__ . '-' . WB_VERSION; diff --git a/repo/includes/specials/SpecialDispatchStats.php b/repo/includes/specials/SpecialDispatchStats.php index bf2c923..7e490e0 100644 --- a/repo/includes/specials/SpecialDispatchStats.php +++ b/repo/includes/specials/SpecialDispatchStats.php @@ -3,6 +3,7 @@ namespace Wikibase\Repo\Specials; use Html; +use Wikibase\DispatchStats; /** * Page for displaying diagnostics about the dispatch process. @@ -63,7 +64,7 @@ $lang = $this-getContext()-getLanguage(); - $stats = new \Wikibase\DispatchStats(); + $stats = new DispatchStats(); $stats-load(); $this-getOutput()-addHTML( Html::rawElement( 'p', array(), @@ -137,4 +138,5 @@ $this-getOutput()-addHTML( Html::closeElement( 'table' )); } + } diff --git a/repo/includes/specials/SpecialEntitiesWithoutDescription.php b/repo/includes/specials/SpecialEntitiesWithoutDescription.php index 982a896..c04f62d 100644 --- a/repo/includes/specials/SpecialEntitiesWithoutDescription.php +++ b/repo/includes/specials/SpecialEntitiesWithoutDescription.php @@ -2,6 +2,8 @@ namespace Wikibase\Repo\Specials; +use Wikibase\Term; + /** * Page for listing entities without description. * @@ -23,7 +25,7 @@ * @return string */ protected function getTermType() { - return \Wikibase\Term::TYPE_DESCRIPTION; + return Term::TYPE_DESCRIPTION; } /** @@ -36,4 +38,5 @@ protected function getLegend() { return $this-msg( 'wikibase-entitieswithoutdescription-legend' )-text(); } + } diff --git a/repo/includes/specials/SpecialEntitiesWithoutLabel.php b/repo/includes/specials/SpecialEntitiesWithoutLabel.php index 375663a..3b346bd 100644 ---
[MediaWiki-commits] [Gerrit] Rewrite NamespaceUtils to be non-static and use one instance - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Rewrite NamespaceUtils to be non-static and use one instance .. Rewrite NamespaceUtils to be non-static and use one instance On a medium-size item, NamespaceUtils::getEntityNamespace was called 935 times, taking noticeable amount of time in profiling results. Change-Id: I9de1c739581a4e2fb0aaaef4cb6506a90e29f2b8 --- M repo/Wikibase.hooks.php R repo/includes/EntityNamespaceLookup.php M repo/includes/WikibaseRepo.php M repo/includes/content/EntityHandler.php M repo/includes/store/sql/EntityPerPageBuilder.php M repo/maintenance/rebuildEntityPerPage.php A repo/tests/phpunit/includes/EntityNamespaceLookupTest.php M repo/tests/phpunit/includes/ItemMoveTest.php D repo/tests/phpunit/includes/NamespaceUtilsTest.php M repo/tests/phpunit/includes/RepoHooksTest.php M repo/tests/phpunit/includes/actions/EditEntityActionTest.php M repo/tests/phpunit/includes/api/BotEditTest.php M repo/tests/phpunit/includes/store/sql/EntityPerPageBuilderTest.php 13 files changed, 203 insertions(+), 115 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index 54376a6..17941cc 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -198,7 +198,9 @@ public static function onNamespaceIsMovable( $ns, $movable ) { wfProfileIn( __METHOD__ ); - if ( NamespaceUtils::isEntityNamespace( $ns ) ) { + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()-getEntityNamespaceLookup(); + + if ( $entityNamespaceLookup-isEntityNamespace( $ns ) ) { $movable = false; } @@ -584,6 +586,8 @@ public static function onWikibaseDeleteData( $reportMessage ) { wfProfileIn( __METHOD__ ); + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()-getEntityNamespaceLookup(); + $reportMessage( 'Deleting data from changes table...' ); $dbw = wfGetDB( DB_MASTER ); @@ -594,7 +598,7 @@ $reportMessage( 'Deleting revisions from Data NS...' ); - $namespaceList = $dbw-makeList( NamespaceUtils::getEntityNamespaces(), LIST_COMMA ); + $namespaceList = $dbw-makeList( $entityNamespaceLookup-getEntityNamespaces(), LIST_COMMA ); $dbw-deleteJoin( 'revision', 'page', @@ -947,8 +951,9 @@ */ public static function onShowSearchHitTitle( $link_t, $titleSnippet, SearchResult $result ) { $title = $result-getTitle(); + $entityNamespaceLookup = WikibsseRepo::getDefaultInstance()-getEntityNamespaceLookup(); - if ( NamespaceUtils::isEntityNamespace( $title-getNamespace() ) ) { + if ( $entityNamespaceLookup-isEntityNamespace( $title-getNamespace() ) ) { $titleSnippet = $title-getPrefixedText(); } @@ -971,7 +976,9 @@ * @return bool */ public static function onTitleGetRestrictionTypes( Title $title, array $types ) { - if ( NamespaceUtils::isEntityNamespace( $title-getNamespace() ) ) { + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()-getEntityNamespaceLookup(); + + if ( $entityNamespaceLookup-isEntityNamespace( $title-getNamespace() ) ) { // Remove create and move protection for Wikibase namespaces $types = array_diff( $types, array( 'create', 'move' ) ); } @@ -1121,7 +1128,9 @@ * @return bool */ public static function onOutputPageBeforeHtmlRegisterConfig( OutputPage $out, $html ) { - if ( !NamespaceUtils::isEntityNamespace( $out-getTitle()-getNamespace() ) ) { + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()-getEntityNamespaceLookup(); + + if ( $entityNamespaceLookup-isEntityNamespace( $out-getTitle()-getNamespace() ) ) { return true; } @@ -1148,7 +1157,9 @@ * @return bool */ public static function onMakeGlobalVariablesScript( $vars, $out ) { - if ( !NamespaceUtils::isEntityNamespace( $out-getTitle()-getNamespace() ) ) { + $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()-getEntityNamespaceLookup(); + + if ( $entityNamespaceLookup-isEntityNamespace( $out-getTitle()-getNamespace() ) ) { return true; } @@ -1182,7 +1193,12 @@ * @return bool */ public static function onContentModelCanBeUsedOn( $contentModel, Title $title, $ok ) { - $expectedModel = array_search( $title-getNamespace(), NamespaceUtils::getEntityNamespaces()
[MediaWiki-commits] [Gerrit] Add @group Database to AvailableBadgesTest - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Add @group Database to AvailableBadgesTest .. Add @group Database to AvailableBadgesTest Since it extends ApiTestCase, api users get created and added to the database. Without @group Database, they were added to the real database instead of the test database. Change-Id: If9f95893f4da7df72e4c963079d65ab05599c311 --- M repo/tests/phpunit/includes/api/AvailableBadgesTest.php 1 file changed, 3 insertions(+), 2 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php index f1b416e..bc54117 100644 --- a/repo/tests/phpunit/includes/api/AvailableBadgesTest.php +++ b/repo/tests/phpunit/includes/api/AvailableBadgesTest.php @@ -9,9 +9,10 @@ * Tests for the AvailableBadges class. * * @group API + * @group Database * @group Wikibase * @group WikibaseAPI - * @gorup WikibaseRepo + * @group WikibaseRepo * @group medium * * @licence GNU GPL v2+ @@ -47,4 +48,4 @@ $this-assertEquals( array_keys( self::$badgeItems ), $result['badges'] ); } -} \ No newline at end of file +} -- To view, visit https://gerrit.wikimedia.org/r/167554 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If9f95893f4da7df72e4c963079d65ab05599c311 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] We can now finally get rid of this evil thing! - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/167432 Change subject: We can now finally get rid of this evil thing! .. We can now finally get rid of this evil thing! This reverts commit 7dd22df2d6553212971b325ffac101f3dce719fa. Change-Id: I9345f6f673b02c06514978bcb4b531c0675fddd0 --- M lib/WikibaseLib.php 1 file changed, 0 insertions(+), 16 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/32/167432/1 diff --git a/lib/WikibaseLib.php b/lib/WikibaseLib.php index e969d61..afe7ad9 100644 --- a/lib/WikibaseLib.php +++ b/lib/WikibaseLib.php @@ -52,22 +52,6 @@ include_once( __DIR__ . '/../vendor/autoload.php' ); } -// TODO: Needed for deserializing Snaks in DataModel 0.x. Remove with DataModel 1.x! -if( !array_key_exists( 'evilDataValueMap', $GLOBALS ) ) { - $GLOBALS['evilDataValueMap'] = array(); -} -$GLOBALS['evilDataValueMap'] = array_merge( - $GLOBALS['evilDataValueMap'], -array( - 'globecoordinate' = 'DataValues\GlobeCoordinateValue', - 'monolingualtext' = 'DataValues\MonolingualTextValue', - 'multilingualtext' = 'DataValues\MultilingualTextValue', - 'quantity' = 'DataValues\QuantityValue', - 'time' = 'DataValues\TimeValue', - 'wikibase-entityid' = 'Wikibase\DataModel\Entity\EntityIdValue', -) -); - call_user_func( function() { global $wgExtensionCredits, $wgJobClasses, $wgHooks, $wgResourceModules, $wgMessagesDirs; -- To view, visit https://gerrit.wikimedia.org/r/167432 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9345f6f673b02c06514978bcb4b531c0675fddd0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Be evil and use MediaWikiTestCase::assertTag for phpunit 4.3... - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Be evil and use MediaWikiTestCase::assertTag for phpunit 4.3 compat .. Be evil and use MediaWikiTestCase::assertTag for phpunit 4.3 compat Change-Id: I337e6bd480415eb4ca08b6c0eb5ef9027f774b10 --- M client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php M repo/tests/phpunit/includes/ItemDisambiguationTest.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php 3 files changed, 6 insertions(+), 3 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php b/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php index 4564cf1..f535857 100644 --- a/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php +++ b/client/tests/phpunit/includes/hooks/BaseTemplateAfterPortalHandlerTest.php @@ -2,6 +2,7 @@ namespace Wikibase\Test; +use MediaWikiTestCase; use Wikibase\Client\Hooks\BaseTemplateAfterPortletHandler; /** @@ -35,7 +36,7 @@ if ( $expected === null ) { $this-assertNull( $formattedLink ); } else { - $this-assertTag( $expected, $formattedLink ); + MediaWikiTestCase::assertTag( $expected, $formattedLink ); } } diff --git a/repo/tests/phpunit/includes/ItemDisambiguationTest.php b/repo/tests/phpunit/includes/ItemDisambiguationTest.php index b482994..3cfb8d8 100644 --- a/repo/tests/phpunit/includes/ItemDisambiguationTest.php +++ b/repo/tests/phpunit/includes/ItemDisambiguationTest.php @@ -7,6 +7,7 @@ use Wikibase\DataModel\Entity\ItemId; use Wikibase\ItemDisambiguation; use Wikibase\Lib\EntityIdFormatter; +use MediaWikiTestCase; /** * @covers Wikibase\ItemDisambiguation @@ -120,7 +121,7 @@ $html = $disambig-getHTML( $items ); foreach ( $matchers as $key = $matcher ) { - $this-assertTag( $matcher, $html, Failed to match HTML output with tag '{$key}' ); + MediaWikiTestCase::assertTag( $matcher, $html, Failed to match HTML output with tag '{$key}' ); } } diff --git a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php index 7b358a7..45c498f 100644 --- a/repo/tests/phpunit/includes/View/SiteLinksViewTest.php +++ b/repo/tests/phpunit/includes/View/SiteLinksViewTest.php @@ -3,6 +3,7 @@ namespace Wikibase\Test; use MediaWikiSite; +use MediaWikiTestCase; use SiteList; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Item; @@ -59,7 +60,7 @@ $value = $siteLinksView-getHtml( $item-getSiteLinks(), $item-getId(), $groups, $editable ); $this-assertInternalType( 'string', $value ); - $this-assertTag( $expectedValue, $value, $value . ' did not match ' . var_export( $expectedValue, true ) ); + MediaWikiTestCase::assertTag( $expectedValue, $value, $value . ' did not match ' . var_export( $expectedValue, true ) ); } public function getHtmlProvider() { -- To view, visit https://gerrit.wikimedia.org/r/167245 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I337e6bd480415eb4ca08b6c0eb5ef9027f774b10 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use DispatchingEntityIdParser instead of BasicEntityIdParser... - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Use DispatchingEntityIdParser instead of BasicEntityIdParser in repo .. Use DispatchingEntityIdParser instead of BasicEntityIdParser in repo Constructing a new instance of BasicEntityIdParser, then calling BasicEntityIdParser::getBuilders each time BasicEntityIdParser::parse() is called (total of 3314 when purging a medium-size item page) is costly, in terms of time and memory consumption. Instead, we should be using DispatchingEntityIdParser and can use a single instance of it via the WikibaseRepo factory. Change-Id: I3529daefdec950a4377f503f50f07d53a29ae3b1 --- M repo/includes/SummaryFormatter.php M repo/includes/WikibaseRepo.php M repo/includes/content/EntityContent.php M repo/includes/content/EntityHandler.php M repo/includes/content/ItemHandler.php M repo/includes/content/PropertyHandler.php M repo/includes/rdf/RdfBuilder.php M repo/includes/store/sql/EntityPerPageTable.php M repo/includes/store/sql/SqlStore.php M repo/maintenance/rebuildItemsPerSite.php M repo/tests/phpunit/includes/UpdateRepoOnMoveJobTest.php M repo/tests/phpunit/includes/store/StoreTest.php M repo/tests/phpunit/includes/store/sql/EntityPerPageTableTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 14 files changed, 60 insertions(+), 32 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/SummaryFormatter.php b/repo/includes/SummaryFormatter.php index 59dab3e..519dfcd 100644 --- a/repo/includes/SummaryFormatter.php +++ b/repo/includes/SummaryFormatter.php @@ -8,7 +8,6 @@ use Language; use MWException; use ValueFormatters\ValueFormatter; -use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdParsingException; diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index f3b6149..a6667bf 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -450,7 +450,8 @@ public function getStore() { if ( !$this-store ) { $this-store = new SqlStore( - $this-getEntityContentDataCodec() + $this-getEntityContentDataCodec(), + $this-getEntityIdParser() ); } @@ -861,6 +862,7 @@ $codec, array( $validator ), $errorLocalizer, + $this-getEntityIdParser(), $siteLinkStore, $this-getLegacyFormatDetectorCallback() ); @@ -885,6 +887,7 @@ $codec, array( $validator ), $errorLocalizer, + $this-getEntityIdParser(), $propertyInfoStore, $this-getLegacyFormatDetectorCallback() ); @@ -925,4 +928,4 @@ ); } -} \ No newline at end of file +} diff --git a/repo/includes/content/EntityContent.php b/repo/includes/content/EntityContent.php index bccbc52..bdbb543 100644 --- a/repo/includes/content/EntityContent.php +++ b/repo/includes/content/EntityContent.php @@ -23,7 +23,6 @@ use User; use ValueFormatters\FormatterOptions; use ValueFormatters\ValueFormatter; -use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; use Wikibase\Lib\Serializers\SerializationOptions; @@ -312,19 +311,21 @@ $context-setLanguage( $languageCode ); } + $wikibaseRepo = WikibaseRepo::getDefaultInstance(); + if ( !$uiLanguageFallbackChain ) { - $factory = WikibaseRepo::getDefaultInstance()-getLanguageFallbackChainFactory(); + $factory = $wikibaseRepo-getLanguageFallbackChainFactory(); $uiLanguageFallbackChain = $factory-newFromContextForPageView( $context ); } $formatterOptions-setOption( 'languages', $uiLanguageFallbackChain ); // get all the necessary services - $snakFormatter = WikibaseRepo::getDefaultInstance()-getSnakFormatterFactory() + $snakFormatter = $wikibaseRepo-getSnakFormatterFactory() -getSnakFormatter( SnakFormatter::FORMAT_HTML_WIDGET, $formatterOptions ); - $entityInfoBuilderFactory = WikibaseRepo::getDefaultInstance()-getStore()-getEntityInfoBuilderFactory(); - $entityContentFactory = WikibaseRepo::getDefaultInstance()-getEntityContentFactory(); + $entityInfoBuilderFactory =
[MediaWiki-commits] [Gerrit] Some minor style changes in the scribunto code - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Some minor style changes in the scribunto code .. Some minor style changes in the scribunto code Change-Id: Ie64f8e0c1aac48515a58e8d16e425d3fdea287d0 --- M client/includes/scribunto/Scribunto_LuaWikibaseEntityLibrary.php M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php M client/includes/scribunto/WikibaseLuaBindings.php 3 files changed, 7 insertions(+), 3 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/includes/scribunto/Scribunto_LuaWikibaseEntityLibrary.php b/client/includes/scribunto/Scribunto_LuaWikibaseEntityLibrary.php index 2b0f02c..67323e7 100644 --- a/client/includes/scribunto/Scribunto_LuaWikibaseEntityLibrary.php +++ b/client/includes/scribunto/Scribunto_LuaWikibaseEntityLibrary.php @@ -54,6 +54,8 @@ * Register mw.wikibase.lua library * * @since 0.5 +* +* @return array */ public function register() { $lib = array( diff --git a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php index a5d035d..2e6d4c5 100644 --- a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php +++ b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php @@ -52,6 +52,8 @@ * Register mw.wikibase.lua library * * @since 0.4 +* +* @return array */ public function register() { $lib = array( @@ -99,7 +101,7 @@ * * @param string $pageTitle * -* @return string $id +* @return array */ public function getEntityId( $pageTitle = null ) { $this-checkType( 'getEntityByTitle', 1, $pageTitle, 'string' ); diff --git a/client/includes/scribunto/WikibaseLuaBindings.php b/client/includes/scribunto/WikibaseLuaBindings.php index 571bf71..017becc 100644 --- a/client/includes/scribunto/WikibaseLuaBindings.php +++ b/client/includes/scribunto/WikibaseLuaBindings.php @@ -124,7 +124,7 @@ * * @return array */ - public function getEntity( $prefixedEntityId = null, $legacyStyle = false ) { + public function getEntity( $prefixedEntityId, $legacyStyle = false ) { $prefixedEntityId = trim( $prefixedEntityId ); $entityId = $this-entityIdParser-parse( $prefixedEntityId ); @@ -194,7 +194,7 @@ * * @return string|null $id */ - public function getEntityId( $pageTitle = null ) { + public function getEntityId( $pageTitle ) { $id = $this-siteLinkTable-getItemIdForLink( $this-siteId, $pageTitle ); if ( !$id ) { -- To view, visit https://gerrit.wikimedia.org/r/167128 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie64f8e0c1aac48515a58e8d16e425d3fdea287d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Hoo man h...@online.de Gerrit-Reviewer: Jackmcbarn jackmcb...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace deprecated getPrefixedId in Repo - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Replace deprecated getPrefixedId in Repo .. Replace deprecated getPrefixedId in Repo Change-Id: I6b59524a81a37f198d1f60c7ade446395cb6f5fe --- M repo/Wikibase.hooks.php M repo/includes/ChangeOp/ChangeOpClaimRemove.php M repo/includes/ChangeOp/ChangeOpMainSnak.php M repo/includes/ChangeOp/ChangeOpQualifier.php M repo/includes/ChangeOp/ChangeOpQualifierRemove.php M repo/includes/ChangeOp/ChangeOpReference.php M repo/includes/ChangeOp/ChangeOpReferenceRemove.php M repo/includes/ChangeOp/ChangeOpSiteLink.php M repo/includes/ChangeOp/ChangeOpStatementRank.php M repo/includes/ClaimSummaryBuilder.php M repo/includes/UpdateRepoOnMoveJob.php M repo/includes/api/ModifyEntity.php M repo/includes/api/SearchEntities.php M repo/includes/specials/SpecialSetSiteLink.php M repo/includes/store/sql/PropertyInfoTableBuilder.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimRemoveTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpMainSnakTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpReferenceRemoveTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpReferenceTest.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php M repo/tests/phpunit/includes/EntityViewTest.php M repo/tests/phpunit/includes/Hook/OutputPageJsConfigHookHandlerTest.php M repo/tests/phpunit/includes/SummaryFormatterTest.php M repo/tests/phpunit/includes/View/ClaimsViewTest.php M repo/tests/phpunit/includes/View/SnakHtmlGeneratorTest.php M repo/tests/phpunit/includes/api/GetClaimsTest.php M repo/tests/phpunit/includes/api/SetReferenceTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 32 files changed, 55 insertions(+), 54 deletions(-) Approvals: Bene: Looks good to me, but someone else must approve Jeroen De Dauw: Looks good to me, approved diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index a08e42b..a1140ce 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -652,9 +652,9 @@ $entityType = preg_replace( '/^wikibase-/i', '', $entityContent-getEntity()-getType() ); // add class to body so it's clear this is a wb item: - $bodyAttrs['class'] .= wb-entitypage wb-{$entityType}page; + $bodyAttrs['class'] .= ' wb-entitypage wb-' . $entityType . 'page'; // add another class with the ID of the item: - $bodyAttrs['class'] .= wb-{$entityType}page-{$entityContent-getEntityId()-getPrefixedId()}; + $bodyAttrs['class'] .= ' wb-' . $entityType . 'page-' . $entityContent-getEntityId()-getSerialization(); if ( $sk-getRequest()-getCheck( 'diff' ) ) { $bodyAttrs['class'] .= ' wb-diffpage'; diff --git a/repo/includes/ChangeOp/ChangeOpClaimRemove.php b/repo/includes/ChangeOp/ChangeOpClaimRemove.php index 82758e2..6084a14 100644 --- a/repo/includes/ChangeOp/ChangeOpClaimRemove.php +++ b/repo/includes/ChangeOp/ChangeOpClaimRemove.php @@ -88,7 +88,7 @@ */ protected function getClaimSummaryArgs( Snak $mainSnak ) { $propertyId = $mainSnak-getPropertyId(); - return array( array( $propertyId-getPrefixedId() = $mainSnak ) ); + return array( array( $propertyId-getSerialization() = $mainSnak ) ); } /** diff --git a/repo/includes/ChangeOp/ChangeOpMainSnak.php b/repo/includes/ChangeOp/ChangeOpMainSnak.php index 5d7a536..9687a1a 100644 --- a/repo/includes/ChangeOp/ChangeOpMainSnak.php +++ b/repo/includes/ChangeOp/ChangeOpMainSnak.php @@ -146,7 +146,7 @@ */ protected function getClaimSummaryArgs( Snak $mainSnak ) { $propertyId = $mainSnak-getPropertyId(); - return array( array( $propertyId-getPrefixedId() = $mainSnak ) ); + return array( array( $propertyId-getSerialization() = $mainSnak ) ); } /** diff --git a/repo/includes/ChangeOp/ChangeOpQualifier.php b/repo/includes/ChangeOp/ChangeOpQualifier.php index 0341bb6..31c663f 100644 --- a/repo/includes/ChangeOp/ChangeOpQualifier.php +++ b/repo/includes/ChangeOp/ChangeOpQualifier.php @@ -111,7 +111,7 @@ */ protected function addQualifier( Snaks $qualifiers, Summary $summary = null ) { if ( $qualifiers-hasSnak( $this-snak ) ) { - throw new ChangeOpException( Claim has already a qualifier with hash {$this-snak-getHash()} ); +
[MediaWiki-commits] [Gerrit] Remove 'changesAsJson' setting - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove 'changesAsJson' setting .. Remove 'changesAsJson' setting Hasn't been used in production in more than a year, so no need to keep this around any longer. Change-Id: Icc698e43d9eff65542a8c2232960d97e19ce7ef6 --- M docs/options.wiki M lib/config/WikibaseLib.default.php M lib/includes/changes/ChangeRow.php M lib/includes/changes/DiffChange.php M lib/tests/phpunit/changes/ChangeRowTest.php 5 files changed, 19 insertions(+), 46 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/docs/options.wiki b/docs/options.wiki index 56a4161..8329cfa 100644 --- a/docs/options.wiki +++ b/docs/options.wiki @@ -40,7 +40,6 @@ 'commonsMedia', ) /poem -;changesAsJson: Use JSON to represent changes in the database. This is true per default, and there is no reason to set it to false, except for compatibility with very old client side code. == Repository Settings == diff --git a/lib/config/WikibaseLib.default.php b/lib/config/WikibaseLib.default.php index 292605f..e5c3456 100644 --- a/lib/config/WikibaseLib.default.php +++ b/lib/config/WikibaseLib.default.php @@ -39,10 +39,6 @@ // local by default. Set to something LBFactory understands. 'changesDatabase' = false, - // JSON is more robust against version differences between repo and client, - // but only once the client can cope with the JSON form of the change. - 'changesAsJson' = true, - // list of logical database names of local client wikis. // may contain mappings from site-id to db-name. 'localClientDatabases' = array(), diff --git a/lib/includes/changes/ChangeRow.php b/lib/includes/changes/ChangeRow.php index cfb5b51..6960db8 100644 --- a/lib/includes/changes/ChangeRow.php +++ b/lib/includes/changes/ChangeRow.php @@ -232,27 +232,22 @@ * @return string */ public function serializeInfo( array $info ) { - if ( Settings::get( changesAsJson ) === true ) { - // Make sure we never serialize objects. - // This is a lot of overhead, so we only do it during testing. - if ( defined( 'MW_PHPUNIT_TEST' ) ) { - array_walk_recursive( - $info, - function ( $v ) { - if ( is_object( $v ) ) { - throw new MWException( Refusing to serialize PHP object of type - . get_class( $v ) ); - } + // Make sure we never serialize objects. + // This is a lot of overhead, so we only do it during testing. + if ( defined( 'MW_PHPUNIT_TEST' ) ) { + array_walk_recursive( + $info, + function ( $v ) { + if ( is_object( $v ) ) { + throw new MWException( Refusing to serialize PHP object of type + . get_class( $v ) ); } - ); - } - - //XXX: we could JSON_UNESCAPED_UNICODE here, perhaps. - return json_encode( $info ); - } else { - // for compatibility with old client code. - return serialize( $info ); + } + ); } + + //XXX: we could JSON_UNESCAPED_UNICODE here, perhaps. + return json_encode( $info ); } /** diff --git a/lib/includes/changes/DiffChange.php b/lib/includes/changes/DiffChange.php index b603516..08fb037 100644 --- a/lib/includes/changes/DiffChange.php +++ b/lib/includes/changes/DiffChange.php @@ -111,11 +111,9 @@ */ public function serializeInfo( array $info ) { if ( isset( $info['diff'] ) $info['diff'] instanceof DiffOp ) { - if ( Settings::get( changesAsJson ) === true ) { - /* @var \Diff\DiffOp $op */ - $op = $info['diff']; - $info['diff'] = $op-toArray( array( $this, 'arrayalizeObjects' ) ); - } + /* @var \Diff\DiffOp $op */ + $op = $info['diff']; + $info['diff'] = $op-toArray( array( $this, 'arrayalizeObjects' ) ); }
[MediaWiki-commits] [Gerrit] Use the new Statement constructor everywhere - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Use the new Statement constructor everywhere .. Use the new Statement constructor everywhere Step to tackle DataModel 2.0 See also GitHub: https://github.com/wmde/WikibaseDataModel/pull/234 Change-Id: I97d38b057427af37e076895b12f14e61920c1c65 --- M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php M client/tests/phpunit/includes/scribunto/WikibaseLuaIntegrationTestItemSetUpHelper.php M lib/includes/serializers/ClaimSerializer.php M lib/tests/phpunit/changes/TestChanges.php M lib/tests/phpunit/serializers/ClaimSerializerTest.php M lib/tests/phpunit/serializers/ClaimsSerializerTest.php M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php M lib/tests/phpunit/serializers/ItemSerializerTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpQualifierTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpReferenceTest.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php M repo/tests/phpunit/includes/Diff/ClaimDifferTest.php M repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/EntityViewTest.php M repo/tests/phpunit/includes/Hook/MakeGlobalVariablesScriptHandlerTest.php M repo/tests/phpunit/includes/ParserOutputJsConfigBuilderTest.php M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php M repo/tests/phpunit/includes/api/ApiXmlFormatTest.php M repo/tests/phpunit/includes/api/RemoveClaimsTest.php M repo/tests/phpunit/includes/api/RemoveQualifiersTest.php M repo/tests/phpunit/includes/api/RemoveReferencesTest.php M repo/tests/phpunit/includes/api/SetClaimTest.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php M repo/tests/phpunit/includes/api/SetQualifierTest.php M repo/tests/phpunit/includes/content/ItemContentTest.php 29 files changed, 97 insertions(+), 76 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php index e497a04..061a298 100644 --- a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php +++ b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php @@ -39,23 +39,23 @@ $entityLookup = new MockRepository(); - $statement1 = new Statement( new PropertyValueSnak( + $statement1 = new Statement( new Claim( new PropertyValueSnak( $propertyId, new StringValue( 'a kitten!' ) - ) ); + ) ) ); $statement1-setGuid( 'Q42$1' ); - $statement2 = new Statement( new PropertyValueSnak( + $statement2 = new Statement( new Claim( new PropertyValueSnak( $propertyId, new StringValue( 'two kittens!!' ) - ) ); + ) ) ); $statement2-setGuid( 'Q42$2' ); // A Statement with a lower rank which should not affect the output - $statement3 = new Statement( new PropertyValueSnak( + $statement3 = new Statement( new Claim( new PropertyValueSnak( $propertyId, new StringValue( 'three kittens!!!' ) - ) ); + ) ) ); $statement3-setGuid( 'Q42$3' ); $statement3-setRank( Claim::RANK_DEPRECATED ); diff --git a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php index 9b9fcb8..4662ee6 100644 --- a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php +++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php @@ -4,6 +4,7 @@ use Language; use Wikibase\Client\Scribunto\WikibaseLuaEntityBindings; +use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\PropertyId; @@ -53,7 +54,7 @@ new PropertyId( 'P123456' ), 'somevalue' ); - $statement = new Statement( $snak ); + $statement = new Statement( new Claim( $snak ) ); $statement-setGuid( 'gsdfgsadg' ); $item = Item::newEmpty(); diff --git a/client/tests/phpunit/includes/scribunto/WikibaseLuaIntegrationTestItemSetUpHelper.php
[MediaWiki-commits] [Gerrit] Small refactoring for ReferencedEntitiesFinder - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Small refactoring for ReferencedEntitiesFinder .. Small refactoring for ReferencedEntitiesFinder There still was a warning shown in PHPStorm. The introduction of the $dataValue variable makes it go away. Also the array of EntityId objects had a strange name. $links sounds like a list of SiteLink objects. Change-Id: Ibb6e011b6de9cce1629619c810b94f13a1ff33de --- M lib/includes/ReferencedEntitiesFinder.php 1 file changed, 12 insertions(+), 7 deletions(-) Approvals: Bene: Looks good to me, but someone else must approve Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/ReferencedEntitiesFinder.php b/lib/includes/ReferencedEntitiesFinder.php index db694b2..89f4b7d 100644 --- a/lib/includes/ReferencedEntitiesFinder.php +++ b/lib/includes/ReferencedEntitiesFinder.php @@ -24,22 +24,27 @@ * @since 0.4 * * @param Snak[] $snaks -* @return EntityId[] +* +* @return EntityId[] Entity id strings pointing to EntityId objects. */ public function findSnakLinks( array $snaks ) { - $links = array(); + $entityIds = array(); foreach ( $snaks as $snak ) { $propertyId = $snak-getPropertyId(); - $links[$propertyId-getSerialization()] = $propertyId; + $entityIds[$propertyId-getSerialization()] = $propertyId; - if( $snak instanceof PropertyValueSnak $snak-getDataValue() instanceof EntityIdValue ) { - $entityId = $snak-getDataValue()-getEntityId(); - $links[$entityId-getSerialization()] = $entityId; + if ( $snak instanceof PropertyValueSnak ) { + $dataValue = $snak-getDataValue(); + + if ( $dataValue instanceof EntityIdValue ) { + $entityId = $dataValue-getEntityId(); + $entityIds[$entityId-getSerialization()] = $entityId; + } } } - return $links; + return $entityIds; } } -- To view, visit https://gerrit.wikimedia.org/r/156042 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibb6e011b6de9cce1629619c810b94f13a1ff33de Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Bene benestar.wikime...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Stop using aliases outside Wikibase namespace - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Stop using aliases outside Wikibase namespace .. Stop using aliases outside Wikibase namespace This is split from I687c61c. Change-Id: I10d7c3a81f2ce00d82e79a50f715c82a0211f3be --- M repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php M repo/tests/phpunit/includes/EntityModificationTestHelper.php M repo/tests/phpunit/includes/api/RemoveReferencesTest.php 3 files changed, 6 insertions(+), 6 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php b/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php index 682ed91..33b40b4 100644 --- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php +++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php @@ -14,17 +14,17 @@ use ValueValidators\Result; use ValueValidators\ValueValidator; use Wikibase\DataModel\Claim\ClaimGuidParser; -use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\Item; +use Wikibase\DataModel\Entity\PropertyDataTypeLookup; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Snak\PropertyValueSnak; +use Wikibase\DataModel\Statement\Statement; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Lib\ClaimGuidValidator; -use Wikibase\DataModel\Entity\PropertyDataTypeLookup; use Wikibase\Lib\Store\SiteLinkCache; use Wikibase\Validators\CompositeFingerprintValidator; use Wikibase\Validators\CompositeValidator; @@ -511,4 +511,5 @@ return $mock; } + } diff --git a/repo/tests/phpunit/includes/EntityModificationTestHelper.php b/repo/tests/phpunit/includes/EntityModificationTestHelper.php index e597a02..f397fc7 100644 --- a/repo/tests/phpunit/includes/EntityModificationTestHelper.php +++ b/repo/tests/phpunit/includes/EntityModificationTestHelper.php @@ -2,11 +2,11 @@ namespace Wikibase\Test; +use PHPUnit_Framework_Assert as Assert; +use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\Entity; use Wikibase\Lib\Store\EntityRedirect; use Wikibase\Repo\WikibaseRepo; -use PHPUnit_Framework_Assert as Assert; /** * EntityModificationTestHelper @@ -219,4 +219,3 @@ } } - \ No newline at end of file diff --git a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php index 56e8c91..2f87c46 100644 --- a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php +++ b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php @@ -4,7 +4,6 @@ use DataValues\StringValue; use UsageException; -use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Reference; use Wikibase\DataModel\Snak\PropertyNoValueSnak; @@ -12,6 +11,7 @@ use Wikibase\DataModel\Snak\PropertyValueSnak; use Wikibase\DataModel\Snak\Snak; use Wikibase\DataModel\Snak\SnakList; +use Wikibase\DataModel\Statement\Statement; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Repo\WikibaseRepo; -- To view, visit https://gerrit.wikimedia.org/r/165720 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I10d7c3a81f2ce00d82e79a50f715c82a0211f3be Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Adrian Lang adrian.l...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Get rid of ORMTable::getFieldPrefix - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Get rid of ORMTable::getFieldPrefix .. Get rid of ORMTable::getFieldPrefix See I46a0d7e. Change-Id: Ica8b7a8e012adc73ed4d8cc84129e7c6c95e76c3 --- M lib/includes/ChangesTable.php 1 file changed, 2 insertions(+), 9 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/ChangesTable.php b/lib/includes/ChangesTable.php index 0f63910..f01851d 100644 --- a/lib/includes/ChangesTable.php +++ b/lib/includes/ChangesTable.php @@ -29,6 +29,8 @@ } $this-setTargetWiki( $changesDatabase ); + + $this-fieldPrefix = 'change_'; } /** @@ -38,15 +40,6 @@ */ public function getName() { return 'wb_changes'; - } - - /** -* @see ORMTable::getFieldPrefix() -* @since 0.1 -* @return string -*/ - protected function getFieldPrefix() { - return 'change_'; } /** -- To view, visit https://gerrit.wikimedia.org/r/165178 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ica8b7a8e012adc73ed4d8cc84129e7c6c95e76c3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix bad assumptions in EntityParserOutputGenerator - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix bad assumptions in EntityParserOutputGenerator .. Fix bad assumptions in EntityParserOutputGenerator This code crashed with an can not convert object to string for me when I tried to import an XML dump. It assumes that all 'commonsMedia' snaks always (in all old revisions) contained string values. There is no guarantee this is true. This also removes some disturbing PHPStorm warnings in ValuesFinder. Change-Id: If87e65b8d347605ffdb944fdb8b4aaa6d7bd51cb --- M lib/includes/ValuesFinder.php M repo/includes/EntityParserOutputGenerator.php 2 files changed, 23 insertions(+), 17 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/ValuesFinder.php b/lib/includes/ValuesFinder.php index 720fb6b..e0646d5 100644 --- a/lib/includes/ValuesFinder.php +++ b/lib/includes/ValuesFinder.php @@ -2,7 +2,9 @@ namespace Wikibase; +use DataValues\DataValue; use Wikibase\DataModel\Entity\PropertyDataTypeLookup; +use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Entity\PropertyNotFoundException; /** @@ -36,7 +38,9 @@ $found = array(); foreach ( $snaks as $snak ) { - if ( $this-isMatchingSnak( $snak, $dataType ) ) { + if ( $snak instanceof PropertyValueSnak + $this-isMatchingDataType( $snak-getPropertyId(), $dataType ) + ) { $dataValue = $snak-getDataValue(); $found[$dataValue-getHash()] = $dataValue; } @@ -45,22 +49,18 @@ return $found; } - private function isMatchingSnak( Snak $snak, $dataType ) { - if ( !$snak instanceof PropertyValueSnak ) { - return false; - } - + /** +* @param PropertyId $propertyId +* @param string $dataType +* +* @return bool +*/ + private function isMatchingDataType( PropertyId $propertyId, $dataType ) { try { - $type = $this-propertyDataTypeLookup-getDataTypeIdForProperty( $snak-getPropertyId() ); + return $this-propertyDataTypeLookup-getDataTypeIdForProperty( $propertyId ) === $dataType; } catch ( PropertyNotFoundException $ex ) { return false; } - - if ( $type !== $dataType ) { - return false; - } - - return true; } } diff --git a/repo/includes/EntityParserOutputGenerator.php b/repo/includes/EntityParserOutputGenerator.php index 610d2a6..c526375 100644 --- a/repo/includes/EntityParserOutputGenerator.php +++ b/repo/includes/EntityParserOutputGenerator.php @@ -3,8 +3,8 @@ namespace Wikibase; use ParserOutput; -use Wikibase\DataModel\SiteLinkList; use Wikibase\DataModel\Entity\PropertyDataTypeLookup; +use Wikibase\DataModel\SiteLinkList; use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\Store\EntityTitleLookup; @@ -119,14 +119,20 @@ $usedUrls = $valuesFinder-findFromSnaks( $snaks, 'url' ); foreach ( $usedUrls as $url ) { - $pout-addExternalLink( $url-getValue() ); + $value = $url-getValue(); + if ( is_string( $value ) ) { + $pout-addExternalLink( $value ); + } } // treat CommonsMedia values as file transclusions -- $usedImages = $valuesFinder-findFromSnaks( $snaks, 'commonsMedia' ); - foreach( $usedImages as $image ) { - $pout-addImage( str_replace( ' ', '_', $image-getValue() ) ); + foreach ( $usedImages as $image ) { + $value = $image-getValue(); + if ( is_string( $value ) ) { + $pout-addImage( str_replace( ' ', '_', $value ) ); + } } } -- To view, visit https://gerrit.wikimedia.org/r/165203 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If87e65b8d347605ffdb944fdb8b4aaa6d7bd51cb Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Bene benestar.wikime...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix reference snaks handling in ClaimHtmlGenerator - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix reference snaks handling in ClaimHtmlGenerator .. Fix reference snaks handling in ClaimHtmlGenerator If we pass $reference-getSnaks() as a constructor param for ByPropertyIdArray, then in some situations the snaks in the reference itself are getting cast to array and then HashArray-setElement() has an array instead of SnakList which causes an uncaught exception. Instead storing $snaks as a local variable and converting that to an array, when instantiating the ByPropertyIdArray, then this issue is avoided and the code will be more robust. Bug: 71479 Change-Id: Ia5e9e7d7f7010fd3a3faa73067d3075225cb91e5 --- M repo/includes/ClaimHtmlGenerator.php 1 file changed, 4 insertions(+), 2 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/ClaimHtmlGenerator.php b/repo/includes/ClaimHtmlGenerator.php index 165f8e0..1ce9220 100644 --- a/repo/includes/ClaimHtmlGenerator.php +++ b/repo/includes/ClaimHtmlGenerator.php @@ -121,7 +121,7 @@ * @return string */ protected function getHtmlForQualifiers( Snaks $qualifiers, array $entityInfo ) { - $qualifiersByProperty = new ByPropertyIdArray( $qualifiers ); + $qualifiersByProperty = new ByPropertyIdArray( iterator_to_array( $qualifiers ) ); $qualifiersByProperty-buildIndex(); $snaklistviewsHtml = ''; @@ -171,7 +171,9 @@ * @return string */ protected function getHtmlForReference( $reference, array $entityInfo ) { - $referenceSnaksByProperty = new ByPropertyIdArray( $reference-getSnaks() ); + $snaks = $reference-getSnaks(); + + $referenceSnaksByProperty = new ByPropertyIdArray( iterator_to_array( $snaks ) ); $referenceSnaksByProperty-buildIndex(); $snaklistviewsHtml = ''; -- To view, visit https://gerrit.wikimedia.org/r/164767 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia5e9e7d7f7010fd3a3faa73067d3075225cb91e5 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move Diff-related classes into namespace - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Move Diff-related classes into namespace .. Move Diff-related classes into namespace Change-Id: If16ddd6f7b4840cb38e6f448e17cf23c3c6ea536 --- M repo/includes/ClaimSummaryBuilder.php R repo/includes/Diff/ClaimDiffer.php R repo/includes/Diff/ClaimDifference.php R repo/includes/Diff/ClaimDifferenceVisualizer.php R repo/includes/Diff/DiffOpValueFormatter.php R repo/includes/Diff/DiffView.php R repo/includes/Diff/EntityContentDiffView.php R repo/includes/Diff/EntityDiffVisualizer.php M repo/includes/actions/EditEntityAction.php M repo/includes/api/SetClaim.php M repo/includes/content/EntityHandler.php M repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php R repo/tests/phpunit/includes/Diff/ClaimDifferTest.php R repo/tests/phpunit/includes/Diff/ClaimDifferenceTest.php R repo/tests/phpunit/includes/Diff/ClaimDifferenceVisualizerTest.php R repo/tests/phpunit/includes/Diff/DiffOpValueFormatterTest.php R repo/tests/phpunit/includes/Diff/DiffViewTest.php R repo/tests/phpunit/includes/Diff/EntityContentDiffViewTest.php R repo/tests/phpunit/includes/Diff/EntityDiffVisualizerTest.php 19 files changed, 49 insertions(+), 36 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/ClaimSummaryBuilder.php b/repo/includes/ClaimSummaryBuilder.php index 5e98795..04c56b1 100644 --- a/repo/includes/ClaimSummaryBuilder.php +++ b/repo/includes/ClaimSummaryBuilder.php @@ -3,6 +3,7 @@ namespace Wikibase; use InvalidArgumentException; +use Wikibase\Repo\Diff\ClaimDiffer; /** * EditSummary-Builder for claim operations diff --git a/repo/includes/ClaimDiffer.php b/repo/includes/Diff/ClaimDiffer.php similarity index 94% rename from repo/includes/ClaimDiffer.php rename to repo/includes/Diff/ClaimDiffer.php index bd01646..ad30474 100644 --- a/repo/includes/ClaimDiffer.php +++ b/repo/includes/Diff/ClaimDiffer.php @@ -1,10 +1,14 @@ ?php -namespace Wikibase; +namespace Wikibase\Repo\Diff; use Diff\Differ\Differ; use Diff\DiffOp\Diff\Diff; use Diff\DiffOp\DiffOpChange; +use Wikibase\DataModel\Claim\Claim; +use Wikibase\DataModel\ReferenceList; +use Wikibase\DataModel\Snak\SnakList; +use Wikibase\DataModel\Statement\Statement; /** * Class for generating a ClaimDifference given two claims. diff --git a/repo/includes/ClaimDifference.php b/repo/includes/Diff/ClaimDifference.php similarity index 98% rename from repo/includes/ClaimDifference.php rename to repo/includes/Diff/ClaimDifference.php index a05fc0f..8d0fd65 100644 --- a/repo/includes/ClaimDifference.php +++ b/repo/includes/Diff/ClaimDifference.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace Wikibase\Repo\Diff; use Comparable; use Diff\DiffOp\Diff\Diff; diff --git a/repo/includes/ClaimDifferenceVisualizer.php b/repo/includes/Diff/ClaimDifferenceVisualizer.php similarity index 98% rename from repo/includes/ClaimDifferenceVisualizer.php rename to repo/includes/Diff/ClaimDifferenceVisualizer.php index 021507c..808dc24 100644 --- a/repo/includes/ClaimDifferenceVisualizer.php +++ b/repo/includes/Diff/ClaimDifferenceVisualizer.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace Wikibase\Repo\Diff; use Diff\DiffOp\Diff\Diff; use Diff\DiffOp\DiffOpAdd; @@ -13,6 +13,10 @@ use RuntimeException; use ValueFormatters\FormattingException; use ValueFormatters\ValueFormatter; +use Wikibase\DataModel\Claim\Claim; +use Wikibase\DataModel\Entity\EntityId; +use Wikibase\DataModel\Snak\Snak; +use Wikibase\DataModel\Snak\SnakList; use Wikibase\Lib\Serializers\ClaimSerializer; use Wikibase\Lib\SnakFormatter; diff --git a/repo/includes/DiffOpValueFormatter.php b/repo/includes/Diff/DiffOpValueFormatter.php similarity index 99% rename from repo/includes/DiffOpValueFormatter.php rename to repo/includes/Diff/DiffOpValueFormatter.php index 24c956c..1bfb0c2 100644 --- a/repo/includes/DiffOpValueFormatter.php +++ b/repo/includes/Diff/DiffOpValueFormatter.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace Wikibase\Repo\Diff; use Diff; use Html; diff --git a/repo/includes/DiffView.php b/repo/includes/Diff/DiffView.php similarity index 99% rename from repo/includes/DiffView.php rename to repo/includes/Diff/DiffView.php index 2d63337..8b15c61 100644 --- a/repo/includes/DiffView.php +++ b/repo/includes/Diff/DiffView.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace Wikibase\Repo\Diff; use ContextSource; use Diff\DiffOp\Diff\Diff; diff --git a/repo/includes/EntityContentDiffView.php b/repo/includes/Diff/EntityContentDiffView.php similarity index 99% rename from repo/includes/EntityContentDiffView.php rename to repo/includes/Diff/EntityContentDiffView.php index a6c204d..8cd7d2e 100644 --- a/repo/includes/EntityContentDiffView.php +++ b/repo/includes/Diff/EntityContentDiffView.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace
[MediaWiki-commits] [Gerrit] Fix DispatchStats::hasStats - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix DispatchStats::hasStats .. Fix DispatchStats::hasStats Change-Id: Ib2204df2c0a5028588634990afe7aec65847adba --- M repo/includes/store/sql/DispatchStats.php M repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php 2 files changed, 26 insertions(+), 1 deletion(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/store/sql/DispatchStats.php b/repo/includes/store/sql/DispatchStats.php index 5f9c10f..b3db135 100644 --- a/repo/includes/store/sql/DispatchStats.php +++ b/repo/includes/store/sql/DispatchStats.php @@ -156,8 +156,11 @@ return $n; } + /** +* @return bool +*/ public function hasStats() { - return is_array( $this-clientStates ); + return is_array( $this-clientStates ) !empty( $this-clientStates ); } /** diff --git a/repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php b/repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php index dad4c52..dea6010 100644 --- a/repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php +++ b/repo/tests/phpunit/includes/store/sql/DispatchStatsTest.php @@ -446,4 +446,26 @@ $this-assertStateEquals( $expected, $stats-getStalest()); } + + public function testHasStats() { + $stats = $this-getDispatchStats(); + + $this-assertTrue( $stats-hasStats() ); + + // No stats there before load has been called. + $unloadedStats = new DispatchStats(); + $this-assertFalse( $unloadedStats-hasStats() ); + } + + public function testHasNoStats() { + $dbw = wfGetDB( DB_MASTER ); + + $dbw-delete( 'wb_changes', '*' ); + $dbw-delete( 'wb_changes_dispatch', '*' ); + + $stats = new DispatchStats(); + $stats-load( time() ); + + $this-assertFalse( $stats-hasStats() ); // Still no stats as the table is empty + } } -- To view, visit https://gerrit.wikimedia.org/r/160376 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib2204df2c0a5028588634990afe7aec65847adba Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Hoo man h...@online.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Bene benestar.wikime...@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove removeReferences from AbstractedRepoApi - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove removeReferences from AbstractedRepoApi .. Remove removeReferences from AbstractedRepoApi Change-Id: Ic82ae1ea311205a32167d2ab76b5d48370e3f62d --- M lib/resources/jquery.wikibase/jquery.wikibase.statementview.js M lib/resources/wikibase.RepoApi/wikibase.AbstractedRepoApi.js 2 files changed, 4 insertions(+), 22 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.js b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.js index 0958357..a5919d0 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.statementview.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.statementview.js @@ -348,15 +348,16 @@ * @return {jQuery.Promise} */ _removeReferenceApiCall: function( reference ) { - var abstractedApi = this.option( 'api' ), + var repoApi = this.option( 'api' ), guid = this.value().getGuid(); - return abstractedApi.removeReferences( + return repoApi.removeReferences( guid, reference.getHash(), wb.getRevisionStore().getClaimRevision( guid ), this.option( 'index' ) - ).done( function( baseRevId ) { + ).done( function( result ) { + var baseRevId = result.pageinfo; // update revision store wb.getRevisionStore().setClaimRevision( baseRevId, guid ); } ); diff --git a/lib/resources/wikibase.RepoApi/wikibase.AbstractedRepoApi.js b/lib/resources/wikibase.RepoApi/wikibase.AbstractedRepoApi.js index f74ce72..4efbbc0 100644 --- a/lib/resources/wikibase.RepoApi/wikibase.AbstractedRepoApi.js +++ b/lib/resources/wikibase.RepoApi/wikibase.AbstractedRepoApi.js @@ -38,25 +38,6 @@ }, /** -* Will remove one or more existing References of a Statement. -* -* @since 0.4 -* -* @param {string} statementGuid -* @param {string|string[]} referenceHashes One or more hashes of the References to be removed. -* @param {number} baseRevId -* @return {jQuery.Promise} Done callbacks will receive new base revision ID as first parameter. -*/ - removeReferences: function( statementGuid, referenceHashes, baseRevId ) { - return this._abstract( - PARENT.prototype.removeReferences.apply( this, arguments ), - function( result ) { - return [ result.pageinfo ]; - } - ); - }, - - /** * Adds a new or updates an existing Reference of a Statement. * * @since 0.4 -- To view, visit https://gerrit.wikimedia.org/r/160649 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic82ae1ea311205a32167d2ab76b5d48370e3f62d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Improve type hints in ValuesFinder - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/161681 Change subject: Improve type hints in ValuesFinder .. Improve type hints in ValuesFinder Change-Id: Ia4c7f881d615f7ba9e0254b320f06312cd481811 --- M lib/includes/ValuesFinder.php 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/81/161681/1 diff --git a/lib/includes/ValuesFinder.php b/lib/includes/ValuesFinder.php index cb46f68..7f017bc 100644 --- a/lib/includes/ValuesFinder.php +++ b/lib/includes/ValuesFinder.php @@ -2,6 +2,8 @@ namespace Wikibase; +use DataValues\DataValue; +use Wikibase\DataModel\Snak\PropertyValueSnak; use Wikibase\Lib\PropertyDataTypeLookup; use Wikibase\Lib\PropertyNotFoundException; @@ -37,6 +39,9 @@ foreach ( $snaks as $snak ) { if ( $this-isMatchingSnak( $snak, $dataType ) ) { + /** +* @var PropertyValueSnak $snak +*/ $dataValue = $snak-getDataValue(); $found[$dataValue-getHash()] = $dataValue; } -- To view, visit https://gerrit.wikimedia.org/r/161681 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia4c7f881d615f7ba9e0254b320f06312cd481811 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use the moved version of PropertyDataTypeLookup and InMemory... - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/161682 Change subject: Use the moved version of PropertyDataTypeLookup and InMemoryDataTypeLookup .. Use the moved version of PropertyDataTypeLookup and InMemoryDataTypeLookup Change-Id: I69d9df29540e4f2090896eb10c5c9cc478762606 --- M client/includes/WikibaseClient.php M client/tests/phpunit/includes/WikibaseClientTest.php M lib/includes/EntityRetrievingDataTypeLookup.php D lib/includes/InMemoryDataTypeLookup.php D lib/includes/PropertyDataTypeLookup.php M lib/includes/PropertyInfoDataTypeLookup.php M lib/includes/SnakConstructionService.php M lib/includes/ValuesFinder.php M lib/includes/formatters/PropertyValueSnakFormatter.php M lib/includes/formatters/WikibaseSnakFormatterBuilders.php M lib/includes/serializers/SerializerFactory.php M lib/includes/serializers/SnakSerializer.php D lib/tests/phpunit/InMemoryDataTypeLookupTest.php M lib/tests/phpunit/MockRepository.php M lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php M lib/tests/phpunit/SnakConstructionServiceTest.php M lib/tests/phpunit/ValuesFinderTest.php M lib/tests/phpunit/formatters/OutputFormatSnakFormatterFactoryTest.php M lib/tests/phpunit/formatters/PropertyValueSnakFormatterTest.php M lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php M lib/tests/phpunit/serializers/SnakSerializerTest.php M repo/includes/EntityParserOutputGenerator.php M repo/includes/Validators/SnakValidator.php M repo/includes/WikibaseRepo.php M repo/includes/api/ApiHelperFactory.php M repo/includes/api/ApiWikibase.php M repo/tests/phpunit/includes/ChangeOp/ChangeOpTestMockProvider.php M repo/tests/phpunit/includes/EntityParserOutputGeneratorTest.php M repo/tests/phpunit/includes/LinkedData/EntityDataRequestHandlerTest.php M repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php M repo/tests/phpunit/includes/WikibaseRepoTest.php M repo/tests/phpunit/includes/api/ApiHelperFactoryTest.php M repo/tests/phpunit/includes/api/GetClaimsTest.php M repo/tests/phpunit/includes/api/ResultBuilderTest.php M repo/tests/phpunit/includes/specials/SpecialEntityDataTest.php 36 files changed, 38 insertions(+), 175 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/82/161682/1 diff --git a/client/includes/WikibaseClient.php b/client/includes/WikibaseClient.php index 045f148..2e7be7c 100644 --- a/client/includes/WikibaseClient.php +++ b/client/includes/WikibaseClient.php @@ -36,7 +36,7 @@ use Wikibase\Lib\EntityRetrievingDataTypeLookup; use Wikibase\Lib\OutputFormatSnakFormatterFactory; use Wikibase\Lib\OutputFormatValueFormatterFactory; -use Wikibase\Lib\PropertyDataTypeLookup; +use Wikibase\DataModel\Entity\PropertyDataTypeLookup; use Wikibase\Lib\PropertyInfoDataTypeLookup; use Wikibase\Lib\Serializers\ForbiddenSerializer; use Wikibase\Lib\SnakFormatter; diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php b/client/tests/phpunit/includes/WikibaseClientTest.php index a8fa543..f677e16 100644 --- a/client/tests/phpunit/includes/WikibaseClientTest.php +++ b/client/tests/phpunit/includes/WikibaseClientTest.php @@ -42,7 +42,7 @@ public function testGetPropertyDataTypeLookupReturnType() { $returnValue = $this-getDefaultInstance()-getPropertyDataTypeLookup(); - $this-assertInstanceOf( 'Wikibase\Lib\PropertyDataTypeLookup', $returnValue ); + $this-assertInstanceOf( 'Wikibase\DataModel\Entity\PropertyDataTypeLookup', $returnValue ); } public function testNewSnakFormatterReturnType() { diff --git a/lib/includes/EntityRetrievingDataTypeLookup.php b/lib/includes/EntityRetrievingDataTypeLookup.php index 6413682..73c89cb 100644 --- a/lib/includes/EntityRetrievingDataTypeLookup.php +++ b/lib/includes/EntityRetrievingDataTypeLookup.php @@ -3,6 +3,7 @@ namespace Wikibase\Lib; use Wikibase\DataModel\Entity\Property; +use Wikibase\DataModel\Entity\PropertyDataTypeLookup; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\Lib\Store\EntityLookup; diff --git a/lib/includes/InMemoryDataTypeLookup.php b/lib/includes/InMemoryDataTypeLookup.php deleted file mode 100644 index 51031c3..000 --- a/lib/includes/InMemoryDataTypeLookup.php +++ /dev/null @@ -1,61 +0,0 @@ -?php - -namespace Wikibase\Lib; - -use InvalidArgumentException; -use Wikibase\DataModel\Entity\PropertyId; - -/** - * PropertyDataTypeLookup that uses an in memory array to retrieve the requested information. - * If the information is not set when requested an exception is thrown. - * This class can be used as a mock in tests. - * - * @since 0.4 - * - * @licence GNU GPL v2+ - * @author Jeroen De Dauw jeroended...@gmail.com - */ -class InMemoryDataTypeLookup implements PropertyDataTypeLookup { - - private $dataTypeIds =
[MediaWiki-commits] [Gerrit] Move RepoLinker into Client namespace - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/161486 Change subject: Move RepoLinker into Client namespace .. Move RepoLinker into Client namespace Change-Id: Id50ed6976763b367d2c016700e55bdaeab215f30 --- M client/includes/RepoItemLinkGenerator.php M client/includes/RepoLinker.php M client/includes/WikibaseClient.php M client/includes/hooks/InfoActionHookHandler.php M client/includes/hooks/MovePageNotice.php M client/includes/recentchanges/ChangeLineFormatter.php M client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php M client/tests/phpunit/includes/RepoLinkerTest.php M client/tests/phpunit/includes/hooks/MovePageNoticeTest.php M client/tests/phpunit/includes/recentchanges/ChangeLineFormatterTest.php 10 files changed, 17 insertions(+), 14 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/86/161486/1 diff --git a/client/includes/RepoItemLinkGenerator.php b/client/includes/RepoItemLinkGenerator.php index 962e080..6337dae 100644 --- a/client/includes/RepoItemLinkGenerator.php +++ b/client/includes/RepoItemLinkGenerator.php @@ -3,6 +3,7 @@ namespace Wikibase; use Title; +use Wikibase\Client\RepoLinker; use Wikibase\DataModel\Entity\EntityIdParser; /** diff --git a/client/includes/RepoLinker.php b/client/includes/RepoLinker.php index 4441985..c68ff27 100644 --- a/client/includes/RepoLinker.php +++ b/client/includes/RepoLinker.php @@ -1,6 +1,6 @@ ?php -namespace Wikibase; +namespace Wikibase\Client; use Html; use InvalidArgumentException; diff --git a/client/includes/WikibaseClient.php b/client/includes/WikibaseClient.php index 0e8d089..045f148 100644 --- a/client/includes/WikibaseClient.php +++ b/client/includes/WikibaseClient.php @@ -46,7 +46,6 @@ use Wikibase\Lib\WikibaseSnakFormatterBuilders; use Wikibase\Lib\WikibaseValueFormatterBuilders; use Wikibase\NamespaceChecker; -use Wikibase\RepoLinker; use Wikibase\Settings; use Wikibase\SettingsArray; use Wikibase\StringNormalizer; @@ -141,7 +140,7 @@ * @since 0.4 * * @param SettingsArray $settings -* @param Language $contentLanguage +* @param Language $contentLanguage * @param SiteStore $siteStore */ public function __construct( @@ -236,7 +235,7 @@ * * @return SnakFormatter */ - public function newSnakFormatter( $format = SnakFormatter::FORMAT_PLAIN, FormatterOptions $options ) { + public function newSnakFormatter( $format = SnakFormatter::FORMAT_PLAIN, FormatterOptions $options ) { return $this-getSnakFormatterFactory()-getSnakFormatter( $format, $options ); } @@ -404,8 +403,8 @@ if ( !in_array( $localId, $this-site-getLocalIds() ) ) { wfDebugLog( __CLASS__, __FUNCTION__ - . : The configured local id $localId does not match any local ID of site $globalId: - . var_export( $this-site-getLocalIds(), true ) ); + . : The configured local id $localId does not match any local ID of site $globalId: + . var_export( $this-site-getLocalIds(), true ) ); } } @@ -445,6 +444,7 @@ if ( !$site ) { wfWarn( 'Cannot find site ' . $siteId . ' in sites table' ); + return true; } @@ -497,6 +497,7 @@ ); $factory = new OutputFormatSnakFormatterFactory( $builders-getSnakFormatterBuildersForFormats() ); + return $factory; } @@ -524,6 +525,7 @@ ); $factory = new OutputFormatValueFormatterFactory( $builders-getValueFormatterBuildersForFormats() ); + return $factory; } @@ -738,4 +740,4 @@ ); } -} +} \ No newline at end of file diff --git a/client/includes/hooks/InfoActionHookHandler.php b/client/includes/hooks/InfoActionHookHandler.php index 2f0f7a1..201e76a 100644 --- a/client/includes/hooks/InfoActionHookHandler.php +++ b/client/includes/hooks/InfoActionHookHandler.php @@ -4,11 +4,11 @@ use IContextSource; use Title; +use Wikibase\Client\RepoLinker; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\SiteLink; use Wikibase\Lib\Store\SiteLinkLookup; use Wikibase\NamespaceChecker; -use Wikibase\RepoLinker; /** * @since 0.5 diff --git a/client/includes/hooks/MovePageNotice.php b/client/includes/hooks/MovePageNotice.php index 7c63a0e..cb94d9c 100644 --- a/client/includes/hooks/MovePageNotice.php +++ b/client/includes/hooks/MovePageNotice.php @@ -6,7 +6,6 @@ use Title; use Wikibase\DataModel\SiteLink; use
[MediaWiki-commits] [Gerrit] Improve docs - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/161488 Change subject: Improve docs .. Improve docs Change-Id: Id5849820056886eb54c57d74c8eab114b1beef8e --- M client/includes/RepoLinker.php 1 file changed, 3 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/88/161488/1 diff --git a/client/includes/RepoLinker.php b/client/includes/RepoLinker.php index 82d9958..586b0a2 100644 --- a/client/includes/RepoLinker.php +++ b/client/includes/RepoLinker.php @@ -23,12 +23,10 @@ private $namespaces; /** -* @since 0.4 -* * @param string $baseUrl * @param string $articlePath * @param string $scriptPath -* @param array $namespaces // repoNamespaces setting +* @param string[] $namespaces // repoNamespaces setting */ public function __construct( $baseUrl, $articlePath, $scriptPath, array $namespaces ) { $this-baseUrl = $baseUrl; @@ -86,8 +84,6 @@ } /** -* Encode a page title -* * @param string $page * * @return string @@ -146,7 +142,7 @@ * @todo: use a more robust mechanism for building entity titles * if efficient enough, maybe EntityTitleLookup. * -* @param EntityId +* @param EntityId $entityId * * @return string */ @@ -164,7 +160,7 @@ /** * Constructs a link to an entity * -* @param EntityId +* @param EntityId $entityId * * @return string */ -- To view, visit https://gerrit.wikimedia.org/r/161488 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id5849820056886eb54c57d74c8eab114b1beef8e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move EntityHandler and derivatives into Repo\Content NS - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/161492 Change subject: Move EntityHandler and derivatives into Repo\Content NS .. Move EntityHandler and derivatives into Repo\Content NS Change-Id: I9cd89e2197440d69952161b38ec7f68aa627eb36 --- M repo/Wikibase.hooks.php M repo/includes/WikibaseRepo.php M repo/includes/actions/ViewEntityAction.php M repo/includes/content/EntityContent.php M repo/includes/content/EntityHandler.php M repo/includes/content/ItemHandler.php M repo/includes/content/PropertyHandler.php M repo/includes/specials/SpecialItemByTitle.php M repo/tests/phpunit/includes/WikibaseRepoTest.php M repo/tests/phpunit/includes/content/EntityHandlerTest.php M repo/tests/phpunit/includes/content/ItemHandlerTest.php M repo/tests/phpunit/includes/content/PropertyHandlerTest.php 12 files changed, 49 insertions(+), 24 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/92/161492/1 diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php index 9e7795f..02ef64b 100644 --- a/repo/Wikibase.hooks.php +++ b/repo/Wikibase.hooks.php @@ -32,6 +32,7 @@ use User; use Wikibase\Hook\MakeGlobalVariablesScriptHandler; use Wikibase\Hook\OutputPageJsConfigHookHandler; +use Wikibase\Repo\Content\EntityHandler; use Wikibase\Repo\View\TextInjector; use Wikibase\Repo\WikibaseRepo; use WikiPage; diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index cc2884b..4df3146 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -25,7 +25,6 @@ use Wikibase\EntityFactory; use Wikibase\InternalSerialization\DeserializerFactory; use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\ItemHandler; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\LanguageFallbackChainFactory; use Wikibase\Lib\Changes\EntityChangeFactory; @@ -51,9 +50,10 @@ use Wikibase\Lib\WikibaseSnakFormatterBuilders; use Wikibase\Lib\WikibaseValueFormatterBuilders; use Wikibase\ParserOutputJsConfigBuilder; -use Wikibase\PropertyHandler; use Wikibase\ReferencedEntitiesFinder; use Wikibase\Repo\Content\EntityContentFactory; +use Wikibase\Repo\Content\ItemHandler; +use Wikibase\Repo\Content\PropertyHandler; use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer; use Wikibase\Repo\Localizer\MessageParameterFormatter; use Wikibase\Repo\Notifications\ChangeNotifier; @@ -495,6 +495,7 @@ ); $factory = new OutputFormatSnakFormatterFactory( $builders-getSnakFormatterBuildersForFormats() ); + return $factory; } @@ -519,6 +520,7 @@ $builders = $this-getValueFormatterBuilders(); $factory = new OutputFormatValueFormatterFactory( $builders-getValueFormatterBuildersForFormats() ); + return $factory; } @@ -712,7 +714,8 @@ private function getChangeTransmitter() { if ( $this-settings-getSetting( 'useChangesTable' ) ) { return new DatabaseChangeTransmitter(); - } else { + } + else { return new DummyChangeTransmitter(); } } @@ -904,7 +907,10 @@ $entitySerializerClass ); } - return array( 'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer', 'isBlobUsingLegacyFormat' ); + return array( + 'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer', + 'isBlobUsingLegacyFormat' + ); } /** @@ -918,4 +924,5 @@ $this-getEntityFactory() ); } -} + +} \ No newline at end of file diff --git a/repo/includes/actions/ViewEntityAction.php b/repo/includes/actions/ViewEntityAction.php index f2118b8..1e177c1 100644 --- a/repo/includes/actions/ViewEntityAction.php +++ b/repo/includes/actions/ViewEntityAction.php @@ -7,6 +7,7 @@ use LogEventsList; use SpecialPage; use ViewAction; +use Wikibase\Repo\Content\EntityHandler; use Wikibase\Repo\Store\EntityPermissionChecker; use Wikibase\Repo\WikibaseRepo; diff --git a/repo/includes/content/EntityContent.php b/repo/includes/content/EntityContent.php index 5ed8dfa..a2b35b0 100644 --- a/repo/includes/content/EntityContent.php +++ b/repo/includes/content/EntityContent.php @@ -32,6 +32,7 @@ use Wikibase\Lib\Store\EntityRedirect; use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Repo\Content\EntityContentDiff; +use Wikibase\Repo\Content\EntityHandler; use Wikibase\Repo\EntitySearchTextGenerator; use Wikibase\Repo\WikibaseRepo; use WikiPage; diff --git a/repo/includes/content/EntityHandler.php b/repo/includes/content/EntityHandler.php index bfe5b87..c74ce31 100644 --- a/repo/includes/content/EntityHandler.php +++
[MediaWiki-commits] [Gerrit] Remove revision from FetchedContent - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove revision from FetchedContent .. Remove revision from FetchedContent revision is not passed in wbUsedEntities anymore. Change-Id: Ied448910055dc32b841be7d05a8718f1d1df2ca3 --- M lib/resources/wikibase.store/store.FetchedContent.js M lib/resources/wikibase.store/store.FetchedContentUnserializer.js 2 files changed, 1 insertion(+), 25 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/resources/wikibase.store/store.FetchedContent.js b/lib/resources/wikibase.store/store.FetchedContent.js index 933ece6..2471350 100644 --- a/lib/resources/wikibase.store/store.FetchedContent.js +++ b/lib/resources/wikibase.store/store.FetchedContent.js @@ -9,23 +9,16 @@ /** * Constructor for objects representing some kind of MediaWiki content fetched from a store. -* Holds the actual content as well as some meta information such as the fetched revision and -* the related title where the content can be found on the wiki. +* Holds the actual content as well as the related title where the content can be found on the wiki. * * TODO: This is just a very basic wrapper for contents right now. This could very will grow * into something more sophisticated system which is aware of different content models, * which would probably result into one constructor (or strategy) per content type. * E.g. FetchedEntity, etc. * -* TODO: Revision should not be optional and probably not null if newest revision fetched. -* Currently we need this because we create FetchedContent for entities the entityselector -* provides (without a revision ID, which is fine from the entity selector's perspective). -* This should be addressed if we do above TODO. -* * @param {Object} data Should contain the following fields: *- content {*} The content which has been fetched *- title {mw.Title} The page the content is related to -*- revision {number} (optional) the revision which has been fetched. * * @constructor * @since 0.4 @@ -38,10 +31,6 @@ throw new Error( 'Can not create fetched content without related title information in field title' ); } data = $.extend( {}, data ); // kill reference, prevent from outside modification - - if( typeof data.revision !== 'number' ) { - data.revision = null; - } this._data = data; }; @@ -75,18 +64,6 @@ */ getTitle: function() { return this._data.title; - }, - - /** -* Returns the revision in which the content has been fetched. Might be null if the newest -* version has been fetched explicitly. -* -* @since 0.4 -* -* @return number -*/ - getRevision: function() { - return this._data.revision; } } ); diff --git a/lib/resources/wikibase.store/store.FetchedContentUnserializer.js b/lib/resources/wikibase.store/store.FetchedContentUnserializer.js index 686a586..6c93906 100644 --- a/lib/resources/wikibase.store/store.FetchedContentUnserializer.js +++ b/lib/resources/wikibase.store/store.FetchedContentUnserializer.js @@ -37,7 +37,6 @@ return new wb.store.FetchedContent( { title: title, - revision: serialization.revision, content: content } ); } -- To view, visit https://gerrit.wikimedia.org/r/160651 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ied448910055dc32b841be7d05a8718f1d1df2ca3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Adrian Lang adrian.l...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Adapt to changes in data-values/geo 1.0.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Adapt to changes in data-values/geo 1.0.0 .. Adapt to changes in data-values/geo 1.0.0 Change-Id: I94078a04bf628f5761c3fd90dff95b2a0bb32452 --- M client/includes/WikibaseClient.php M composer.json M lib/WikibaseLib.php M lib/includes/DataValueFactory.php M lib/includes/formatters/GlobeCoordinateDetailsFormatter.php M lib/includes/formatters/WikibaseValueFormatterBuilders.php M lib/tests/phpunit/WikibaseDataTypeBuildersTest.php M lib/tests/phpunit/formatters/GlobeCoordinateDetailsFormatterTest.php M repo/Wikibase.php M repo/includes/WikibaseRepo.php 10 files changed, 15 insertions(+), 15 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/includes/WikibaseClient.php b/client/includes/WikibaseClient.php index 785edf9..60a22a8 100644 --- a/client/includes/WikibaseClient.php +++ b/client/includes/WikibaseClient.php @@ -646,7 +646,7 @@ 'number' = 'DataValues\NumberValue', 'string' = 'DataValues\StringValue', 'unknown' = 'DataValues\UnknownValue', - 'globecoordinate' = 'DataValues\GlobeCoordinateValue', + 'globecoordinate' = 'DataValues\Geo\Values\GlobeCoordinateValue', 'monolingualtext' = 'DataValues\MonolingualTextValue', 'multilingualtext' = 'DataValues\MultilingualTextValue', 'quantity' = 'DataValues\QuantityValue', diff --git a/composer.json b/composer.json index 9d23dfb..efec9e1 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ data-values/data-values: ~0.1.0, data-values/common: ~0.2.0, - data-values/geo: ~0.2.0, + data-values/geo: ~1.0.0, data-values/interfaces: ~0.1.4, data-values/number: ~0.4.0, data-values/time: ~0.6.0, diff --git a/lib/WikibaseLib.php b/lib/WikibaseLib.php index e969d61..a236a62 100644 --- a/lib/WikibaseLib.php +++ b/lib/WikibaseLib.php @@ -59,7 +59,7 @@ $GLOBALS['evilDataValueMap'] = array_merge( $GLOBALS['evilDataValueMap'], array( - 'globecoordinate' = 'DataValues\GlobeCoordinateValue', + 'globecoordinate' = 'DataValues\Geo\Values\GlobeCoordinateValue', 'monolingualtext' = 'DataValues\MonolingualTextValue', 'multilingualtext' = 'DataValues\MultilingualTextValue', 'quantity' = 'DataValues\QuantityValue', diff --git a/lib/includes/DataValueFactory.php b/lib/includes/DataValueFactory.php index 8120c58..3f5378c 100644 --- a/lib/includes/DataValueFactory.php +++ b/lib/includes/DataValueFactory.php @@ -26,7 +26,7 @@ 'number' = 'DataValues\NumberValue', 'string' = 'DataValues\StringValue', 'unknown' = 'DataValues\UnknownValue', - 'globecoordinate' = 'DataValues\GlobeCoordinateValue', + 'globecoordinate' = 'DataValues\Geo\Values\GlobeCoordinateValue', 'monolingualtext' = 'DataValues\MonolingualTextValue', 'multilingualtext' = 'DataValues\MultilingualTextValue', 'quantity' = 'DataValues\QuantityValue', diff --git a/lib/includes/formatters/GlobeCoordinateDetailsFormatter.php b/lib/includes/formatters/GlobeCoordinateDetailsFormatter.php index df0f02e..a2ed6d8 100644 --- a/lib/includes/formatters/GlobeCoordinateDetailsFormatter.php +++ b/lib/includes/formatters/GlobeCoordinateDetailsFormatter.php @@ -2,13 +2,13 @@ namespace Wikibase\Lib; -use DataValues\GlobeCoordinateValue; +use DataValues\Geo\Formatters\GeoCoordinateFormatter; +use DataValues\Geo\Formatters\GlobeCoordinateFormatter; +use DataValues\Geo\Values\GlobeCoordinateValue; use Html; use InvalidArgumentException; use Message; use ValueFormatters\FormatterOptions; -use ValueFormatters\GeoCoordinateFormatter; -use ValueFormatters\GlobeCoordinateFormatter; use ValueFormatters\ValueFormatter; use ValueFormatters\ValueFormatterBase; diff --git a/lib/includes/formatters/WikibaseValueFormatterBuilders.php b/lib/includes/formatters/WikibaseValueFormatterBuilders.php index 81514cc..45c7098 100644 --- a/lib/includes/formatters/WikibaseValueFormatterBuilders.php +++ b/lib/includes/formatters/WikibaseValueFormatterBuilders.php @@ -7,8 +7,8 @@ use RuntimeException; use ValueFormatters\DecimalFormatter; use ValueFormatters\FormatterOptions; -use ValueFormatters\GeoCoordinateFormatter; -use ValueFormatters\GlobeCoordinateFormatter; +use DataValues\Geo\Formatters\GeoCoordinateFormatter; +use DataValues\Geo\Formatters\GlobeCoordinateFormatter; use ValueFormatters\QuantityFormatter; use ValueFormatters\ValueFormatter; use Wikibase\LanguageFallbackChain;
[MediaWiki-commits] [Gerrit] Fix fatal in EntityContent::getTextForFilters - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix fatal in EntityContent::getTextForFilters .. Fix fatal in EntityContent::getTextForFilters @note there should be a follow up that perhaps extracts this functionality and ensures it is covered by tests. Bug: 70725 Change-Id: I1ad7212401d915ce2878853b6b3969333f9b7a1a --- M repo/includes/content/EntityContent.php 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/content/EntityContent.php b/repo/includes/content/EntityContent.php index 12ae29a..f344303 100644 --- a/repo/includes/content/EntityContent.php +++ b/repo/includes/content/EntityContent.php @@ -414,7 +414,9 @@ 'type', ); - $data = $this-getEntity()-toArray(); + // @todo this text for filters stuff should be it's own class with test coverage! + $codec = WikibaseRepo::getDefaultInstance()-getEntityContentDataCodec(); + $data = json_decode( $codec-encodeEntity( $this-getEntity() ), true ); $values = self::collectValues( $data, $ignore ); -- To view, visit https://gerrit.wikimedia.org/r/159797 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1ad7212401d915ce2878853b6b3969333f9b7a1a Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Use DataModel 1.0 .. Use DataModel 1.0 Change-Id: I1ec5ac5c8f7b4a6793edd058882685ad0818d26d --- M composer.json M lib/includes/serializers/LegacyInternalClaimSerializer.php M lib/includes/serializers/LegacyInternalEntitySerializer.php M lib/tests/phpunit/NoBadDependencyUsageTest.php D lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M repo/config/Wikibase.default.php M repo/tests/phpunit/includes/WikibaseRepoTest.php 7 files changed, 8 insertions(+), 114 deletions(-) Approvals: Tobias Gritschacher: Verified; Looks good to me, but someone else must approve Bene: Looks good to me, but someone else must approve Thiemo Mättig (WMDE): Looks good to me, approved diff --git a/composer.json b/composer.json index 93a2d19..ca670a6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~0.9.0, + wikibase/data-model: ~1.0@dev, wikibase/data-model-javascript: ~0.3.0, wikibase/data-model-serialization: ~1.0.1, wikibase/internal-serialization: ~1.1, diff --git a/lib/includes/serializers/LegacyInternalClaimSerializer.php b/lib/includes/serializers/LegacyInternalClaimSerializer.php index d3fe17b..9bdcdf7 100644 --- a/lib/includes/serializers/LegacyInternalClaimSerializer.php +++ b/lib/includes/serializers/LegacyInternalClaimSerializer.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Wikibase\DataModel\Claim\Claim; +use Wikibase\Repo\WikibaseRepo; class LegacyInternalClaimSerializer implements \Serializers\Serializer { @@ -20,7 +21,7 @@ throw new InvalidArgumentException( '$claim must be an Claim' ); } - return $claim-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalClaimSerializer()-serialize( $claim ); } } diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php index 062bbf3..c33bea2 100644 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ b/lib/includes/serializers/LegacyInternalEntitySerializer.php @@ -5,6 +5,7 @@ use InvalidArgumentException; use Serializers\Serializer as NewStyleSerializer; use Wikibase\DataModel\Entity\Entity; +use Wikibase\Repo\WikibaseRepo; /** * Serializer for generating the legacy serialization of an Entity. @@ -31,7 +32,7 @@ throw new InvalidArgumentException( '$entity must be an Entity' ); } - return $entity-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalEntitySerializer()-serialize( $entity ); } /** diff --git a/lib/tests/phpunit/NoBadDependencyUsageTest.php b/lib/tests/phpunit/NoBadDependencyUsageTest.php index b74eda6..b33e3d0 100644 --- a/lib/tests/phpunit/NoBadDependencyUsageTest.php +++ b/lib/tests/phpunit/NoBadDependencyUsageTest.php @@ -16,8 +16,8 @@ public function testNoRepoUsageInLib() { // Increasing this allowance is forbidden - $this-assertStringNotInLib( 'WikibaseRepo' . '::', 2 ); - $this-assertStringNotInLib( 'Wikibase\\Repo\\', 2 ); + $this-assertStringNotInLib( 'WikibaseRepo' . '::', 4 ); + $this-assertStringNotInLib( 'Wikibase\\Repo\\', 4 ); } public function testNoClientUsageInLib() { diff --git a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php b/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php deleted file mode 100644 index c2eb039..000 --- a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php +++ /dev/null @@ -1,63 +0,0 @@ -?php - -namespace Wikibase\Test; - -use DataValues\Serializers\DataValueSerializer; -use RuntimeException; -use Wikibase\DataModel\Entity\Item; -use Wikibase\DataModel\Entity\ItemId; -use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Serializers\LegacyInternalEntitySerializer; - -/** - * @covers Wikibase\Lib\Serializers\LegacyInternalEntitySerializer - * - * @group WikibaseLib - * @group Wikibase - * @group WikibaseSerialization - * - * @licence GNU GPL v2+ - * @author Daniel Kinzler - */ -class LegacyInternalEntitySerializerTest extends \PHPUnit_Framework_TestCase { - - public function legacyFormatBlobProvider() { - $entity = Item::newEmpty(); - $entity-setId( new ItemId( 'Q12' ) ); - $entity-setLabel( 'en', 'Test' ); - - // make legacy blob - $legacySerializer = new LegacyInternalEntitySerializer(); - $oldBlob = json_encode( $legacySerializer-serialize( $entity ) ); - -
[MediaWiki-commits] [Gerrit] Use a stable version of DataModel - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157973 Change subject: Use a stable version of DataModel .. Use a stable version of DataModel And compatible versions of the serialization components Change-Id: I4fd92033add84b13834ecb9efecf3dc63c26199c --- M composer.json 1 file changed, 3 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/73/157973/1 diff --git a/composer.json b/composer.json index ca670a6..78669ac 100644 --- a/composer.json +++ b/composer.json @@ -35,10 +35,10 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~1.0@dev, + wikibase/data-model: ~1.0, wikibase/data-model-javascript: ~0.3.0, - wikibase/data-model-serialization: ~1.0.1, - wikibase/internal-serialization: ~1.1, + wikibase/data-model-serialization: ~1.1, + wikibase/internal-serialization: ~1.2, wikibase/serialization-javascript: ~1.1.1, diff/diff: ~1.0, -- To view, visit https://gerrit.wikimedia.org/r/157973 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4fd92033add84b13834ecb9efecf3dc63c26199c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make WikibaseLuaEntityBindingsTest compatible to DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make WikibaseLuaEntityBindingsTest compatible to DataModel 1.0 .. Make WikibaseLuaEntityBindingsTest compatible to DataModel 1.0 Change-Id: Ie3128af3ee7e5e1e1e29def3754ff9acaa2892d1 --- M client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php 1 file changed, 5 insertions(+), 4 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php index b8cd411..5cb2584 100644 --- a/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php +++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaEntityBindingsTest.php @@ -4,7 +4,7 @@ use Language; use Wikibase\Client\Scribunto\WikibaseLuaEntityBindings; -use Wikibase\DataModel\Claim\Claim; +use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\PropertyId; @@ -53,11 +53,11 @@ new PropertyId( 'P123456' ), 'somevalue' ); - $claim = new Claim( $snak ); - $claim-setGuid( 'gsdfgsadg' ); + $statement = new Statement( $snak ); + $statement-setGuid( 'gsdfgsadg' ); $item = Item::newEmpty(); - $item-addClaim( $claim ); + $item-addClaim( $statement ); return $item; } @@ -121,4 +121,5 @@ $wikibaseLibrary = $this-getWikibaseLibraryImplementation(); $this-assertEquals( 'enwiki', $wikibaseLibrary-getGlobalSiteId() ); } + } -- To view, visit https://gerrit.wikimedia.org/r/157655 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie3128af3ee7e5e1e1e29def3754ff9acaa2892d1 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move DataModelSerializationRoundtripTest to DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Move DataModelSerializationRoundtripTest to DataModel 1.0 .. Move DataModelSerializationRoundtripTest to DataModel 1.0 I'm afraid this does not fix all problems with this test but it's a step in the right direction. Change-Id: Ia55fd99a52d4c6c662c789c08593f0ffe1ac4837 --- M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php 1 file changed, 19 insertions(+), 16 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php index a465ebf..06807e1 100644 --- a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php +++ b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php @@ -10,6 +10,7 @@ use DataValues\UnknownValue; use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\Statement; +use Wikibase\DataModel\DeserializerFactory; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\Item; @@ -18,12 +19,14 @@ use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Reference; use Wikibase\DataModel\ReferenceList; +use Wikibase\DataModel\SerializerFactory; use Wikibase\DataModel\SiteLink; use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\DataModel\Snak\PropertyValueSnak; use Wikibase\DataModel\Snak\SnakList; use Wikibase\Lib\Serializers\SerializationOptions; +use Wikibase\Lib\Serializers\SerializerFactory as LegacySerializerFactory; /** * @todo Add tests with $options-setIndexTags( true ). @@ -171,8 +174,8 @@ $item = Item::newEmpty(); $item-setId( new ItemId( 'Q4' ) ); - $this-addClaimsWithoutQualifiers( $item ); - $this-addClaimsWithQualifiers( $item ); + $this-addStatementsWithoutQualifiers( $item ); + $this-addStatementsWithQualifiers( $item ); $this-addStatementsWithRanks( $item ); $this-addStatementsWithQualifiersAndReferences( $item ); $entities[] = $item; @@ -228,22 +231,22 @@ ); } - private function addClaimsWithoutQualifiers( Item $item ) { + private function addStatementsWithoutQualifiers( Item $item ) { foreach ( $this-getSnaks( 'P40' ) as $mainSnak ) { - $claim = new Claim( $mainSnak ); - $this-setGuid( $claim ); - $item-addClaim( $claim ); + $statement = new Statement( $mainSnak ); + $this-setGuid( $statement ); + $item-addClaim( $statement ); } } - private function addClaimsWithQualifiers( Item $item ) { + private function addStatementsWithQualifiers( Item $item ) { $mainSnak = new PropertyNoValueSnak( new PropertyId( 'P501' ) ); $qualifiers = new SnakList( $this-getSnaks( 'P51' ) ); - $claim = new Claim( $mainSnak, $qualifiers ); - $this-setGuid( $claim ); - $item-addClaim( $claim ); + $statement = new Statement( $mainSnak, $qualifiers ); + $this-setGuid( $statement ); + $item-addClaim( $statement ); } private function addStatementsWithRanks( Item $item ) { @@ -275,15 +278,15 @@ $item-addClaim( $statement ); } - private function setGuid( Claim $claim ) { - $claim-setGuid( 'DataModelSerializationRoundtripTest$' . $this-guidCounter ); + private function setGuid( Statement $statement ) { + $statement-setGuid( 'DataModelSerializationRoundtripTest$' . $this-guidCounter ); $this-guidCounter++; } private function getLegacySerializer( Entity $entity ) { $options = new SerializationOptions(); - $legacySerializerFactory = new \Wikibase\Lib\Serializers\SerializerFactory(); + $legacySerializerFactory = new LegacySerializerFactory(); $entityType = $entity-getType(); return $legacySerializerFactory-newSerializerForEntity( $entityType, $options ); } @@ -291,14 +294,14 @@ private function getLegacyUnserializer( Entity $entity ) { $options = new SerializationOptions(); - $legacySerializerFactory = new \Wikibase\Lib\Serializers\SerializerFactory(); + $legacySerializerFactory = new LegacySerializerFactory(); $entityType = $entity-getType(); return $legacySerializerFactory-newUnserializerForEntity(
[MediaWiki-commits] [Gerrit] Make SnaksFinderTest compatible to DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make SnaksFinderTest compatible to DataModel 1.0 .. Make SnaksFinderTest compatible to DataModel 1.0 Change-Id: Iaae8e43ae6e37deddc0d12da5d36be9f9ffc7510 --- M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php 1 file changed, 10 insertions(+), 10 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php index 1c60c60..7a0699b 100644 --- a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php +++ b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php @@ -39,31 +39,31 @@ $entityLookup = new MockRepository(); - $claim1 = new Claim( new PropertyValueSnak( + $statement1 = new Statement( new PropertyValueSnak( $propertyId, new StringValue( 'a kitten!' ) ) ); - $claim1-setGuid( 'Q42$1' ); + $statement1-setGuid( 'Q42$1' ); - $claim2 = new Claim( new PropertyValueSnak( + $statement2 = new Statement( new PropertyValueSnak( $propertyId, new StringValue( 'two kittens!!' ) ) ); - $claim2-setGuid( 'Q42$2' ); + $statement2-setGuid( 'Q42$2' ); // A Statement with a lower rank which should not affect the output - $claim3 = new Statement( new PropertyValueSnak( + $statement3 = new Statement( new PropertyValueSnak( $propertyId, new StringValue( 'three kittens!!!' ) ) ); - $claim3-setGuid( 'Q42$3' ); - $claim3-setRank( Claim::RANK_NORMAL ); + $statement3-setGuid( 'Q42$3' ); + $statement3-setRank( Claim::RANK_DEPRECATED ); $item = Item::newEmpty(); $item-setId( new ItemId( 'Q42' ) ); - $item-addClaim( $claim1 ); - $item-addClaim( $claim2 ); - $item-addClaim( $claim3 ); + $item-addClaim( $statement1 ); + $item-addClaim( $statement2 ); + $item-addClaim( $statement3 ); $property = Property::newFromType( 'string' ); $property-setId( $propertyId ); -- To view, visit https://gerrit.wikimedia.org/r/157647 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaae8e43ae6e37deddc0d12da5d36be9f9ffc7510 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make TestChanges compatible to DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make TestChanges compatible to DataModel 1.0 .. Make TestChanges compatible to DataModel 1.0 Change-Id: Iaa2ea314b3b9f751fcedbcb2b2017d75088a1304 --- M lib/tests/phpunit/changes/TestChanges.php 1 file changed, 5 insertions(+), 6 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/tests/phpunit/changes/TestChanges.php b/lib/tests/phpunit/changes/TestChanges.php index 966..76047da 100644 --- a/lib/tests/phpunit/changes/TestChanges.php +++ b/lib/tests/phpunit/changes/TestChanges.php @@ -5,8 +5,8 @@ use Wikibase\Change; use Wikibase\ChangeRow; use Wikibase\ChangesTable; -use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\Claims; +use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; @@ -174,10 +174,10 @@ // - $propertyId = new PropertyId( 'p23' ); $snak = new PropertyNoValueSnak( $propertyId ); - $claim = new Claim( $snak ); - $claim-setGuid( 'TEST$test-guid' ); + $statement = new Statement( $snak ); + $statement-setGuid( 'TEST$test-guid' ); - $claims = new Claims( array( $claim ) ); + $claims = new Claims( array( $statement ) ); $new-setClaims( $claims ); $changes['add-claim'] = $changeFactory-newFromUpdate( EntityChange::UPDATE, $old, $new ); $old = $new-copy(); @@ -226,9 +226,8 @@ $clones = array(); - /* @var EntityChange $change */ foreach ( $changes as $key = $change ) { - $clones[$key] = clone $change; + $clones[$key] = unserialize( serialize( $change ) ); } return $clones; -- To view, visit https://gerrit.wikimedia.org/r/157646 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iaa2ea314b3b9f751fcedbcb2b2017d75088a1304 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] DM 1.0 compat: do not add claims to properties and add state... - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157346 Change subject: DM 1.0 compat: do not add claims to properties and add statements to items .. DM 1.0 compat: do not add claims to properties and add statements to items Change-Id: I4c3148eb80287b85a30fa4eed2969f4e651b57b1 --- M repo/tests/phpunit/includes/api/RemoveClaimsTest.php 1 file changed, 26 insertions(+), 20 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/46/157346/1 diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php index f1a5227..b88979b 100644 --- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php +++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php @@ -11,6 +11,8 @@ use Wikibase\DataModel\Snak\PropertyNoValueSnak; use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\DataModel\Snak\PropertyValueSnak; +use Wikibase\DataModel\Statement\Statement; +use Wikibase\DataModel\Term\Fingerprint; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Repo\WikibaseRepo; @@ -35,43 +37,47 @@ private static $propertyId; /** -* @param Entity $entity +* @param Item $item * -* @return Entity +* @return Item */ - protected function addClaimsAndSave( Entity $entity ) { + private function addStatementsAndSave( Item $item ) { $store = WikibaseRepo::getDefaultInstance()-getEntityStore(); - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_NEW ); + $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); if ( !isset( self::$propertyId ) ) { self::$propertyId = $this-getNewProperty( 'string' )-getId(); } - /** @var $claims Claim[] */ - $claims[0] = $entity-newClaim( new PropertyNoValueSnak( self::$propertyId ) ); - $claims[1] = $entity-newClaim( new PropertyNoValueSnak( self::$propertyId ) ); - $claims[2] = $entity-newClaim( new PropertySomeValueSnak( self::$propertyId ) ); - $claims[3] = $entity-newClaim( - new PropertyValueSnak( self::$propertyId, new StringValue( 'o_O' ) ) + /** @var $statements Statement[] */ + $statements = array( + new Statement( new PropertyNoValueSnak( self::$propertyId ) ), + new Statement( new PropertyNoValueSnak( self::$propertyId ) ), + new Statement( new PropertySomeValueSnak( self::$propertyId ) ), + new Statement( new PropertyValueSnak( self::$propertyId, new StringValue( 'o_O' ) ) ), ); - foreach( $claims as $key = $claim ){ + foreach( $statements as $statement ){ $guidGenerator = new ClaimGuidGenerator(); - $claim-setGuid( $guidGenerator-newGuid( $entity-getId() ) ); - $entity-addClaim( $claim ); + $statement-setGuid( $guidGenerator-newGuid( $item-getId() ) ); + $item-addClaim( $statement ); } - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_UPDATE ); + $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_UPDATE ); - return $entity; + return $item; } public function entityProvider() { - $property = Property::newFromType( 'string' ); + $fingerprint = Fingerprint::newEmpty(); + $fingerprint-setLabel( 'en', 'kittens' ); + + $nonEmptyItem = Item::newEmpty(); + $nonEmptyItem-setFingerprint( $fingerprint ); return array( - $this-addClaimsAndSave( Item::newEmpty() ), - $this-addClaimsAndSave( $property ), + $this-addStatementsAndSave( Item::newEmpty() ), + $this-addStatementsAndSave( $nonEmptyItem ), ); } @@ -131,7 +137,7 @@ $this-assertFalse( $obtainedEntity-hasClaims() ); } - protected function makeTheRequest( array $claimGuids ) { + private function makeTheRequest( array $claimGuids ) { $params = array( 'action' = 'wbremoveclaims', 'claim' = implode( '|', $claimGuids ), @@ -176,7 +182,7 @@ * * @return Property */ - protected function getNewProperty( $type ) { + private function getNewProperty( $type ) { $property = Property::newFromType( $type ); $store = WikibaseRepo::getDefaultInstance()-getEntityStore(); -- To view, visit
[MediaWiki-commits] [Gerrit] DM 1.0 compat: do not add claims to properties and add state... - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157347 Change subject: DM 1.0 compat: do not add claims to properties and add statements to items .. DM 1.0 compat: do not add claims to properties and add statements to items Change-Id: Ida353b008494fe5fa69c5a1bc3c87e1bb2101f2d --- M repo/tests/phpunit/includes/api/SetClaimValueTest.php 1 file changed, 12 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/47/157347/1 diff --git a/repo/tests/phpunit/includes/api/SetClaimValueTest.php b/repo/tests/phpunit/includes/api/SetClaimValueTest.php index 4561dc9..9524591 100644 --- a/repo/tests/phpunit/includes/api/SetClaimValueTest.php +++ b/repo/tests/phpunit/includes/api/SetClaimValueTest.php @@ -14,7 +14,9 @@ use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\Entity\Property; +use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Snak\PropertyValueSnak; +use Wikibase\DataModel\Claim\Statement; use Wikibase\Lib\EntityIdLinkFormatter; use Wikibase\Lib\SnakFormatter; use Wikibase\Repo\WikibaseRepo; @@ -61,21 +63,21 @@ } /** -* @param Entity $entity -* @param EntityId $propertyId +* @param Item $item +* @param PropertyId $propertyId * -* @return Entity +* @return Item */ - protected function addClaimsAndSave( Entity $entity, EntityId $propertyId ) { + private function addClaimsAndSave( Item $item, PropertyId $propertyId ) { $store = WikibaseRepo::getDefaultInstance()-getEntityStore(); - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_NEW ); + $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); - $claim = $entity-newClaim( new PropertyValueSnak( $propertyId, new \DataValues\StringValue( 'o_O' ) ) ); - $claim-setGuid( $entity-getId()-getPrefixedId() . '$D8404CDA-25E4-4334-AG93-A3290BCD9C0P' ); - $entity-addClaim( $claim ); + $statement = new Statement( new PropertyValueSnak( $propertyId, new StringValue( 'o_O' ) ) ); + $statement-setGuid( $item-getId()-getSerialization() . '$D8404CDA-25E4-4334-AG93-A3290BCD9C0P' ); + $item-addClaim( $statement ); - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_UPDATE ); - return $entity; + $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_UPDATE ); + return $item; } /** @@ -84,13 +86,10 @@ * @return Entity[] */ protected function getEntities( EntityId $propertyId ) { - $property = Property::newFromType( 'string' ); - $item = Item::newEmpty(); return array( $this-addClaimsAndSave( $item, $propertyId ), - $this-addClaimsAndSave( $property, $propertyId ), ); } -- To view, visit https://gerrit.wikimedia.org/r/157347 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ida353b008494fe5fa69c5a1bc3c87e1bb2101f2d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make ChangeOpsMergeTest compatible with DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make ChangeOpsMergeTest compatible with DataModel 1.0 .. Make ChangeOpsMergeTest compatible with DataModel 1.0 Change-Id: I5e68a7039898f45cfaee3081e27759b9dc91f761 --- M repo/tests/phpunit/includes/ChangeOp/ChangeOpsMergeTest.php 1 file changed, 29 insertions(+), 8 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpsMergeTest.php b/repo/tests/phpunit/includes/ChangeOp/ChangeOpsMergeTest.php index c4efeaa..2c69b29 100644 --- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpsMergeTest.php +++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpsMergeTest.php @@ -4,6 +4,7 @@ use Wikibase\ChangeOp\ChangeOpFactoryProvider; use Wikibase\ChangeOp\ChangeOpsMerge; +use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; use Wikibase\Repo\WikibaseRepo; @@ -243,7 +244,10 @@ array( 'm' = array( 'novalue', 56 ), 'q' = array( ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A390BCD9C556' ) + 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A390BCD9C556', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, + ) ), ), array(), @@ -252,7 +256,9 @@ array( 'm' = array( 'novalue', 56 ), 'q' = array( ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A390BCD9C556' + 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A390BCD9C556', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, ) ), ), @@ -262,7 +268,10 @@ array( 'm' = array( 'novalue', 56 ), 'q' = array( array( 'novalue', 56 ) ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A3290BCD9C0F' ) + 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A3290BCD9C0F', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, + ) ), ), array(), @@ -271,7 +280,9 @@ array( 'm' = array( 'novalue', 56 ), 'q' = array( array( 'novalue', 56 ) ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A3290BCD9C0F' + 'g' = 'Q111$D8404CDA-25E4-4334-AF13-A3290BCD9C0F', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, ) ), ), @@ -286,7 +297,10 @@ array( 'm' = array( 'novalue', 88 ), 'q' = array( array( 'novalue', 88 ) ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF88-A3290BCD9C0F' ) + 'g' = 'Q111$D8404CDA-25E4-4334-AF88-A3290BCD9C0F', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, + ) ), ), array(), @@ -300,7 +314,9 @@ array( 'm' = array( 'novalue', 88 ), 'q' = array( array( 'novalue', 88 ) ), - 'g' = 'Q111$D8404CDA-25E4-4334-AF88-A3290BCD9C0F' + 'g' = 'Q111$D8404CDA-25E4-4334-AF88-A3290BCD9C0F', + 'refs' = array(), + 'rank' = Claim::RANK_NORMAL, ) ), ), @@ -318,7 +334,10 @@ array(
[MediaWiki-commits] [Gerrit] Make Item/PropertyViewTest compatible with DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make Item/PropertyViewTest compatible with DataModel 1.0 .. Make Item/PropertyViewTest compatible with DataModel 1.0 Change-Id: I4daf8abfbe57b07782514b89e9af937e5d988b12 --- M repo/tests/phpunit/includes/EntityViewTest.php M repo/tests/phpunit/includes/ItemViewTest.php M repo/tests/phpunit/includes/PropertyViewTest.php 3 files changed, 160 insertions(+), 156 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/EntityViewTest.php b/repo/tests/phpunit/includes/EntityViewTest.php index bb22e7e..931171b 100644 --- a/repo/tests/phpunit/includes/EntityViewTest.php +++ b/repo/tests/phpunit/includes/EntityViewTest.php @@ -9,7 +9,7 @@ use RequestContext; use Title; use ValueFormatters\FormatterOptions; -use Wikibase\DataModel\Claim\Claim; +use Wikibase\DataModel\Claim\Statement; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; @@ -18,8 +18,6 @@ use Wikibase\DataModel\Entity\ItemId; use Wikibase\DataModel\Entity\Property; use Wikibase\DataModel\Entity\PropertyId; -use Wikibase\DataModel\Snak\PropertyNoValueSnak; -use Wikibase\DataModel\Snak\PropertySomeValueSnak; use Wikibase\DataModel\Snak\PropertyValueSnak; use Wikibase\DataModel\Snak\Snak; use Wikibase\EntityRevision; @@ -171,16 +169,16 @@ return $entityView; } -private function getSerializationOptions( $langCode, $langCodes, - LanguageFallbackChain $fallbackChain -) { -$langCodes = $langCodes + array( $langCode = $fallbackChain ); + private function getSerializationOptions( $langCode, $langCodes, + LanguageFallbackChain $fallbackChain + ) { + $langCodes = $langCodes + array( $langCode = $fallbackChain ); -$options = new SerializationOptions(); -$options-setLanguages( $langCodes ); + $options = new SerializationOptions(); + $options-setLanguages( $langCodes ); -return $options; -} + return $options; + } protected function getMockRepo() { if ( !isset( self::$mockRepo ) ) { @@ -209,11 +207,11 @@ /** * @param EntityId $id -* @param Claim[] $claims +* @param Statement[] $statements * * @return Entity */ - protected abstract function makeEntity( EntityId $id, $claims = array() ); + protected abstract function makeEntity( EntityId $id, array $statements = array() ); /** * Generates a prefixed entity ID based on a numeric ID. @@ -225,15 +223,15 @@ protected abstract function makeEntityId( $numericId ); /** -* @param Claim[] $claims +* @param Statement[] $statements * * @return EntityRevision */ - protected function newEntityRevisionForClaims( $claims ) { + protected function newEntityRevisionForStatements( array $statements ) { static $revId = 1234; $revId++; - $entity = $this-makeEntity( $this-makeEntityId( $revId ), $claims ); + $entity = $this-makeEntity( $this-makeEntityId( $revId ), $statements ); $timestamp = wfTimestamp( TS_MW ); $revision = new EntityRevision( $entity, $revId, $timestamp ); @@ -267,10 +265,10 @@ $claimGuidGenerator = new ClaimGuidGenerator(); - $claim = new Claim( $snak ); - $claim-setGuid( $claimGuidGenerator-newGuid( $itemId ) ); + $statement = new Statement( $snak ); + $statement-setGuid( $claimGuidGenerator-newGuid( $itemId ) ); - $entity-addClaim( $claim ); + $entity-addClaim( $statement ); $timestamp = wfTimestamp( TS_MW ); $revision = new EntityRevision( $entity, 13044, $timestamp ); @@ -280,32 +278,8 @@ ); } - /** -* @dataProvider getParserOutputLinksProvider -* -* @param Claim[] $claims -* @param EntityId[] $expectedLinks -*/ - public function testParserOutputLinks( array $claims, $expectedLinks ) { - $entityRevision = $this-newEntityRevisionForClaims( $claims ); - $entityView = $this-newEntityView( $entityRevision-getEntity()-getType() ); - - $out = $entityView-getParserOutput( $entityRevision, true, false ); - $links = $out-getLinks(); - - // convert expected links to link structure - foreach ( $expectedLinks as $entityId ) { - $title = $this-getTitleForId( $entityId ); -
[MediaWiki-commits] [Gerrit] Drop/replace some pointless assert() - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Drop/replace some pointless assert() .. Drop/replace some pointless assert() This is related to the planned HHVM switch. assert() depends on a setting and may do nothing. I think most of these assert() are more confusing than helpful. Change-Id: I19044396ba8d6c8046aee465b505efa06ebbb140 --- M lib/includes/SnakFactory.php M lib/includes/changes/ChangeRow.php M lib/includes/formatters/EntityIdLabelFormatter.php M lib/includes/store/CachingPropertyInfoStore.php M repo/includes/LinkedData/EntityDataRequestHandler.php M repo/includes/api/EditEntity.php M repo/includes/rdf/RdfBuilder.php M repo/includes/rdf/RdfSerializer.php 8 files changed, 21 insertions(+), 32 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/SnakFactory.php b/lib/includes/SnakFactory.php index d6a59b1..1f3e8db 100644 --- a/lib/includes/SnakFactory.php +++ b/lib/includes/SnakFactory.php @@ -50,9 +50,6 @@ throw new InvalidArgumentException( bad snak type: $snakType ); } - assert( isset( $snak ) ); - assert( $snak instanceof Snak ); - return $snak; } diff --git a/lib/includes/changes/ChangeRow.php b/lib/includes/changes/ChangeRow.php index c14e196..cfb5b51 100644 --- a/lib/includes/changes/ChangeRow.php +++ b/lib/includes/changes/ChangeRow.php @@ -187,8 +187,6 @@ protected function getInfo( $cache = 'no' ) { $info = $this-getField( 'info' ); - assert( !is_string( $info ) ); - if ( !is_array( $info ) ) { $info = array(); } @@ -278,4 +276,5 @@ return $info; } + } diff --git a/lib/includes/formatters/EntityIdLabelFormatter.php b/lib/includes/formatters/EntityIdLabelFormatter.php index f108ebb..d7e242b 100644 --- a/lib/includes/formatters/EntityIdLabelFormatter.php +++ b/lib/includes/formatters/EntityIdLabelFormatter.php @@ -110,7 +110,6 @@ } } - assert( is_string( $label ) ); return $label; } diff --git a/lib/includes/store/CachingPropertyInfoStore.php b/lib/includes/store/CachingPropertyInfoStore.php index 4b19dfc..d2e0074 100644 --- a/lib/includes/store/CachingPropertyInfoStore.php +++ b/lib/includes/store/CachingPropertyInfoStore.php @@ -107,7 +107,6 @@ } } - assert( is_array( $this-propertyInfo ) ); return $this-propertyInfo; } @@ -184,4 +183,5 @@ return true; } -} \ No newline at end of file + +} diff --git a/repo/includes/LinkedData/EntityDataRequestHandler.php b/repo/includes/LinkedData/EntityDataRequestHandler.php index 2dc3a78..82c467d 100644 --- a/repo/includes/LinkedData/EntityDataRequestHandler.php +++ b/repo/includes/LinkedData/EntityDataRequestHandler.php @@ -198,16 +198,12 @@ if ( $format === null || $format === '' ) { // if no format is given, apply content negotiation and return. - $this-httpContentNegotiation( $request, $output, $entityId, $revision ); return; - } else { - //NOTE: will trigger a 415 if the format is not supported - $format = $this-getCanonicalFormat( $format ); } - // we should know the format now. - assert( $format !== null $format !== '' ); + //NOTE: will trigger a 415 if the format is not supported + $format = $this-getCanonicalFormat( $format ); if ( $doc !== null $doc !== '' ) { // if subpage syntax is used, always enforce the canonical form diff --git a/repo/includes/api/EditEntity.php b/repo/includes/api/EditEntity.php index c71a492..dad4565 100644 --- a/repo/includes/api/EditEntity.php +++ b/repo/includes/api/EditEntity.php @@ -496,18 +496,19 @@ foreach ( $claims as $claimArray ) { if( !array_key_exists( 'remove', $claimArray ) ){ - try { $claim = $unserializer-newFromSerialization( $claimArray ); - assert( $claim instanceof Claim ); - } catch ( IllegalValueException $illegalValueException ) { - $this-dieException( $illegalValueException, 'invalid-claim' ); - } catch ( MWException $mwException ) { - $this-dieException( $mwException, 'invalid-claim' ); - } - /** @var $claim Claim
[MediaWiki-commits] [Gerrit] [DNM] DM 1.0 compat - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157075 Change subject: [DNM] DM 1.0 compat .. [DNM] DM 1.0 compat Change-Id: I1ec5ac5c8f7b4a6793edd058882685ad0818d26d --- M composer.json M lib/includes/serializers/LegacyInternalClaimSerializer.php M lib/includes/serializers/LegacyInternalEntitySerializer.php M lib/tests/phpunit/NoBadDependencyUsageTest.php D lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M repo/config/Wikibase.default.php M repo/tests/phpunit/includes/WikibaseRepoTest.php 7 files changed, 8 insertions(+), 114 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/75/157075/1 diff --git a/composer.json b/composer.json index 93a2d19..ca670a6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~0.9.0, + wikibase/data-model: ~1.0@dev, wikibase/data-model-javascript: ~0.3.0, wikibase/data-model-serialization: ~1.0.1, wikibase/internal-serialization: ~1.1, diff --git a/lib/includes/serializers/LegacyInternalClaimSerializer.php b/lib/includes/serializers/LegacyInternalClaimSerializer.php index d3fe17b..9bdcdf7 100644 --- a/lib/includes/serializers/LegacyInternalClaimSerializer.php +++ b/lib/includes/serializers/LegacyInternalClaimSerializer.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Wikibase\DataModel\Claim\Claim; +use Wikibase\Repo\WikibaseRepo; class LegacyInternalClaimSerializer implements \Serializers\Serializer { @@ -20,7 +21,7 @@ throw new InvalidArgumentException( '$claim must be an Claim' ); } - return $claim-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalClaimSerializer()-serialize( $claim ); } } diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php index 062bbf3..c33bea2 100644 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ b/lib/includes/serializers/LegacyInternalEntitySerializer.php @@ -5,6 +5,7 @@ use InvalidArgumentException; use Serializers\Serializer as NewStyleSerializer; use Wikibase\DataModel\Entity\Entity; +use Wikibase\Repo\WikibaseRepo; /** * Serializer for generating the legacy serialization of an Entity. @@ -31,7 +32,7 @@ throw new InvalidArgumentException( '$entity must be an Entity' ); } - return $entity-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalEntitySerializer()-serialize( $entity ); } /** diff --git a/lib/tests/phpunit/NoBadDependencyUsageTest.php b/lib/tests/phpunit/NoBadDependencyUsageTest.php index b74eda6..b33e3d0 100644 --- a/lib/tests/phpunit/NoBadDependencyUsageTest.php +++ b/lib/tests/phpunit/NoBadDependencyUsageTest.php @@ -16,8 +16,8 @@ public function testNoRepoUsageInLib() { // Increasing this allowance is forbidden - $this-assertStringNotInLib( 'WikibaseRepo' . '::', 2 ); - $this-assertStringNotInLib( 'Wikibase\\Repo\\', 2 ); + $this-assertStringNotInLib( 'WikibaseRepo' . '::', 4 ); + $this-assertStringNotInLib( 'Wikibase\\Repo\\', 4 ); } public function testNoClientUsageInLib() { diff --git a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php b/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php deleted file mode 100644 index c2eb039..000 --- a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php +++ /dev/null @@ -1,63 +0,0 @@ -?php - -namespace Wikibase\Test; - -use DataValues\Serializers\DataValueSerializer; -use RuntimeException; -use Wikibase\DataModel\Entity\Item; -use Wikibase\DataModel\Entity\ItemId; -use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Serializers\LegacyInternalEntitySerializer; - -/** - * @covers Wikibase\Lib\Serializers\LegacyInternalEntitySerializer - * - * @group WikibaseLib - * @group Wikibase - * @group WikibaseSerialization - * - * @licence GNU GPL v2+ - * @author Daniel Kinzler - */ -class LegacyInternalEntitySerializerTest extends \PHPUnit_Framework_TestCase { - - public function legacyFormatBlobProvider() { - $entity = Item::newEmpty(); - $entity-setId( new ItemId( 'Q12' ) ); - $entity-setLabel( 'en', 'Test' ); - - // make legacy blob - $legacySerializer = new LegacyInternalEntitySerializer(); - $oldBlob = json_encode( $legacySerializer-serialize( $entity ) ); - - // fake ancient legacy blob: - //
[MediaWiki-commits] [Gerrit] Make GetClaimsTest compatible with DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make GetClaimsTest compatible with DataModel 1.0 .. Make GetClaimsTest compatible with DataModel 1.0 Change-Id: I81a1ec3c209edfd8d8a4279f624e0d9b89234450 --- M repo/tests/phpunit/includes/api/GetClaimsTest.php 1 file changed, 34 insertions(+), 21 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php b/repo/tests/phpunit/includes/api/GetClaimsTest.php index 505f4ae..2c6841d 100644 --- a/repo/tests/phpunit/includes/api/GetClaimsTest.php +++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php @@ -40,41 +40,53 @@ /** * @param Entity $entity +* @param int $flags * * @return Entity */ - protected function addClaimsAndSave( Entity $entity ) { - wfSuppressWarnings(); // We are referencing properties that don't exist. Not relevant here. - + private function save( Entity $entity, $flags = EDIT_NEW ) { $store = WikibaseRepo::getDefaultInstance()-getEntityStore(); - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_NEW ); - /** @var $claims Claim[] */ - $claims[0] = $entity-newClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ); - $claims[1] = $entity-newClaim( new PropertyNoValueSnak( new PropertyId( 'P404' ) ) ); - $claims[2] = $entity-newClaim( new PropertySomeValueSnak( new PropertyId( 'P42' ) ) ); - $claims[3] = $entity-newClaim( new PropertyValueSnak( new PropertyId( 'P9001' ), new StringValue( 'o_O' ) ) ); - - foreach( $claims as $key = $claim ){ - $claim-setGuid( $entity-getId()-getPrefixedId() . '$D8404CDA-56A1-4334-AF13-A3290BCD9CL' . $key ); - $entity-addClaim( $claim ); - } - - $store-saveEntity( $entity, '', $GLOBALS['wgUser'], EDIT_UPDATE ); - wfRestoreWarnings(); + $store-saveEntity( $entity, '', $GLOBALS['wgUser'], $flags ); return $entity; } /** +* @param Item $item +* +* @return Item +*/ + private function addStatementsAndSave( Item $item ) { + $this-save( $item ); + + /** @var $statements Statement[] */ + $statements[0] = $item-newClaim( new PropertyNoValueSnak( new PropertyId( 'P42' ) ) ); + $statements[1] = $item-newClaim( new PropertyNoValueSnak( new PropertyId( 'P404' ) ) ); + $statements[2] = $item-newClaim( new PropertySomeValueSnak( new PropertyId( 'P42' ) ) ); + $statements[3] = $item-newClaim( new PropertyValueSnak( new PropertyId( 'P9001' ), new StringValue( 'o_O' ) ) ); + + foreach ( $statements as $key = $statement ) { + $statement-setGuid( $item-getId()-getPrefixedId() . '$D8404CDA-56A1-4334-AF13-A3290BCD9CL' . $key ); + $item-addClaim( $statement ); + } + + wfSuppressWarnings(); // We are referencing properties that don't exist. Not relevant here. + $this-save( $item, EDIT_UPDATE ); + wfRestoreWarnings(); + + return $item; + } + + /** * @return Entity[] */ - protected function getNewEntities() { + private function getNewEntities() { $property = Property::newFromType( 'string' ); return array( - $this-addClaimsAndSave( Item::newEmpty() ), - $this-addClaimsAndSave( $property ), + $this-addStatementsAndSave( Item::newEmpty() ), + $this-save( $property ), ); } @@ -191,7 +203,7 @@ public function testGetInvalidIds( $entity, $property ) { if ( !$entity ) { $item = Item::newEmpty(); - $this-addClaimsAndSave( $item ); + $this-addStatementsAndSave( $item ); $entity = $item-getId()-getSerialization(); } @@ -215,4 +227,5 @@ array( 'whatTheFuck', 'P42' ), ); } + } -- To view, visit https://gerrit.wikimedia.org/r/157098 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I81a1ec3c209edfd8d8a4279f624e0d9b89234450 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___
[MediaWiki-commits] [Gerrit] Add missing class ref and use new method name - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157132 Change subject: Add missing class ref and use new method name .. Add missing class ref and use new method name Change-Id: I35e7c0ce54cb15e2b80b30613ca8d348d967cd29 --- M repo/tests/phpunit/includes/api/SetSiteLinkTest.php 1 file changed, 9 insertions(+), 8 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/32/157132/1 diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php index 2bdee8a..0b94c00 100644 --- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php @@ -3,6 +3,7 @@ namespace Wikibase\Test\Api; use Wikibase\DataModel\Entity\Item; +use Wikibase\DataModel\Entity\ItemId; use Wikibase\Repo\WikibaseRepo; /** @@ -157,8 +158,8 @@ self::$otherItemId = $badge-getId(); WikibaseRepo::getDefaultInstance()-getSettings()-setSetting( 'badgeItems', array( - self::$gaItemId-getPrefixedId() = '', - self::$faItemId-getPrefixedId() = '', + self::$gaItemId-getSerialization() = '', + self::$faItemId-getSerialization() = '', 'Q9' = '', // Just in case we have a wrong config ) ); } @@ -178,11 +179,11 @@ } foreach( $site['badges'] as $dummy ) { if ( $dummy === '{gaItem}' ) { - $dummy = self::$gaItemId-getPrefixedId(); + $dummy = self::$gaItemId-getSerialization(); } elseif ( $dummy === '{faItem}' ) { - $dummy = self::$faItemId-getPrefixedId(); + $dummy = self::$faItemId-getSerialization(); } elseif ( $dummy === '{otherItem}' ) { - $dummy = self::$otherItemId-getPrefixedId(); + $dummy = self::$otherItemId-getSerialization(); } } } @@ -204,7 +205,7 @@ if ( isset( $params['badges'] ) ) { $params['badges'] = str_replace( array( '{gaItem}', '{faItem}', '{otherItem}' ), - array( self::$gaItemId-getPrefixedId(), self::$faItemId-getPrefixedId(), self::$otherItemId-getPrefixedId() ), + array( self::$gaItemId-getSerialization(), self::$faItemId-getSerialization(), self::$otherItemId-getSerialization() ), $params['badges'] ); } @@ -312,7 +313,7 @@ if ( isset( $params['badges'] ) ) { $params['badges'] = str_replace( array( '{gaItem}', '{faItem}', '{otherItem}' ), - array( self::$gaItemId-getPrefixedId(), self::$faItemId-getPrefixedId(), self::$otherItemId-getPrefixedId() ), + array( self::$gaItemId-getSerialization(), self::$faItemId-getSerialization(), self::$otherItemId-getSerialization() ), $params['badges'] ); } @@ -331,7 +332,7 @@ if ( isset( $params['badges'] ) ) { $params['badges'] = str_replace( array( '{gaItem}', '{faItem}', '{otherItem}' ), - array( self::$gaItemId-getPrefixedId(), self::$faItemId-getPrefixedId(), self::$otherItemId-getPrefixedId() ), + array( self::$gaItemId-getSerialization(), self::$faItemId-getSerialization(), self::$otherItemId-getSerialization() ), $params['badges'] ); } -- To view, visit https://gerrit.wikimedia.org/r/157132 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I35e7c0ce54cb15e2b80b30613ca8d348d967cd29 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make SetSiteLinkTest compatible with DM 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157133 Change subject: Make SetSiteLinkTest compatible with DM 1.0 .. Make SetSiteLinkTest compatible with DM 1.0 Change-Id: Ic09717b287fb86610b6719d41a013d6431a4c228 --- M repo/tests/phpunit/includes/api/SetSiteLinkTest.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/33/157133/1 diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php index 0b94c00..b137639 100644 --- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php @@ -254,7 +254,7 @@ ); $this-assertArrayHasKey( 'badges', $sitelink ); - $this-assertEquals( $expSitelink['badges'], $sitelink['badges'], + $this-assertArrayEquals( $expSitelink['badges'], $sitelink['badges'], Returned incorrect badges ); } else if ( empty( $expected['value'] ) ) { -- To view, visit https://gerrit.wikimedia.org/r/157133 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic09717b287fb86610b6719d41a013d6431a4c228 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Sop using deprecated methods in SpecialItemDisambiguationTest - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157135 Change subject: Sop using deprecated methods in SpecialItemDisambiguationTest .. Sop using deprecated methods in SpecialItemDisambiguationTest Change-Id: I7386e312bfbf18ea7bbfcda52e336974174123e0 --- M repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/35/157135/1 diff --git a/repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php b/repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php index 57ebc5a..b5084e0 100644 --- a/repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php +++ b/repo/tests/phpunit/includes/specials/SpecialItemDisambiguationTest.php @@ -82,17 +82,17 @@ $one = Item::newEmpty(); $one-setId( new ItemId( 'Q1' ) ); - $one-setLabel( 'en', 'one' ); - $one-setLabel( 'de', 'eins' ); - $one-setDescription( 'en', 'number' ); - $one-setDescription( 'de', 'Zahl' ); + $one-getFingerprint()-setLabel( 'en', 'one' ); + $one-getFingerprint()-setLabel( 'de', 'eins' ); + $one-getFingerprint()-setDescription( 'en', 'number' ); + $one-getFingerprint()-setDescription( 'de', 'Zahl' ); $repo-putEntity( $one ); $oneone = Item::newEmpty(); $oneone-setId( new ItemId( 'Q11' ) ); - $oneone-setLabel( 'en', 'oneone' ); - $oneone-setLabel( 'de', 'einseins' ); + $oneone-getFingerprint()-setLabel( 'en', 'oneone' ); + $oneone-getFingerprint()-setLabel( 'de', 'einseins' ); $repo-putEntity( $oneone ); -- To view, visit https://gerrit.wikimedia.org/r/157135 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7386e312bfbf18ea7bbfcda52e336974174123e0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Stop using deprecated DM functions in ItemDisambiguationTest - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/157136 Change subject: Stop using deprecated DM functions in ItemDisambiguationTest .. Stop using deprecated DM functions in ItemDisambiguationTest Change-Id: Iebe3cb4c2dab8ff7968d02dba6d1b73471560f7e --- M repo/tests/phpunit/includes/ItemDisambiguationTest.php 1 file changed, 6 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/36/157136/1 diff --git a/repo/tests/phpunit/includes/ItemDisambiguationTest.php b/repo/tests/phpunit/includes/ItemDisambiguationTest.php index 902b68a..416eb41 100644 --- a/repo/tests/phpunit/includes/ItemDisambiguationTest.php +++ b/repo/tests/phpunit/includes/ItemDisambiguationTest.php @@ -34,15 +34,15 @@ public function getHTMLProvider() { $one = Item::newEmpty(); $one-setId( new ItemId( 'Q1' ) ); - $one-setLabel( 'en', 'one' ); - $one-setLabel( 'de', 'eins' ); - $one-setDescription( 'en', 'number' ); - $one-setDescription( 'de', 'Zahl' ); + $one-getFingerprint()-setLabel( 'en', 'one' ); + $one-getFingerprint()-setLabel( 'de', 'eins' ); + $one-getFingerprint()-setDescription( 'en', 'number' ); + $one-getFingerprint()-setDescription( 'de', 'Zahl' ); $oneone = Item::newEmpty(); $oneone-setId( new ItemId( 'Q11' ) ); - $oneone-setLabel( 'en', 'oneone' ); - $oneone-setLabel( 'de', 'einseins' ); + $oneone-getFingerprint()-setLabel( 'en', 'oneone' ); + $oneone-getFingerprint()-setLabel( 'de', 'einseins' ); $cases = array(); -- To view, visit https://gerrit.wikimedia.org/r/157136 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iebe3cb4c2dab8ff7968d02dba6d1b73471560f7e Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove wfSuppressWarnings - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove wfSuppressWarnings .. Remove wfSuppressWarnings Change-Id: Ic3fefd2c4e10df1c8540312371809a02922837fc --- M repo/tests/phpunit/includes/api/GetClaimsTest.php M repo/tests/phpunit/includes/api/RemoveQualifiersTest.php M repo/tests/phpunit/includes/api/RemoveReferencesTest.php 3 files changed, 0 insertions(+), 6 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/api/GetClaimsTest.php b/repo/tests/phpunit/includes/api/GetClaimsTest.php index 2c6841d..1006552 100644 --- a/repo/tests/phpunit/includes/api/GetClaimsTest.php +++ b/repo/tests/phpunit/includes/api/GetClaimsTest.php @@ -71,9 +71,7 @@ $item-addClaim( $statement ); } - wfSuppressWarnings(); // We are referencing properties that don't exist. Not relevant here. $this-save( $item, EDIT_UPDATE ); - wfRestoreWarnings(); return $item; } diff --git a/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php b/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php index 8974030..0fdeadd 100644 --- a/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php +++ b/repo/tests/phpunit/includes/api/RemoveQualifiersTest.php @@ -76,7 +76,6 @@ foreach ( $this-statementProvider() as $statement ) { $item = Item::newEmpty(); - wfSuppressWarnings(); // We are referencing properties that don't exist. Not relevant here. $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); $guidGenerator = new ClaimGuidGenerator(); @@ -84,7 +83,6 @@ $item-addClaim( $statement ); $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_UPDATE ); - wfRestoreWarnings(); $this-assertInternalType( 'string', $statement-getGuid() ); diff --git a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php index 5e4651e..56e8c91 100644 --- a/repo/tests/phpunit/includes/api/RemoveReferencesTest.php +++ b/repo/tests/phpunit/includes/api/RemoveReferencesTest.php @@ -75,7 +75,6 @@ foreach ( $this-statementProvider() as $statement ) { $item = Item::newEmpty(); - wfSuppressWarnings(); // We are referencing properties that don't exist. Not relevant here. $store = WikibaseRepo::getDefaultInstance()-getEntityStore(); $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_NEW ); @@ -84,7 +83,6 @@ $item-addClaim( $statement ); $store-saveEntity( $item, '', $GLOBALS['wgUser'], EDIT_UPDATE ); - wfRestoreWarnings(); $references = $statement-getReferences(); -- To view, visit https://gerrit.wikimedia.org/r/157134 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic3fefd2c4e10df1c8540312371809a02922837fc Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix SetSiteLinkTest - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix SetSiteLinkTest .. Fix SetSiteLinkTest Change-Id: Ie8934df2da349cd25e94c2825ce4368cf98731ec --- M repo/tests/phpunit/includes/api/SetSiteLinkTest.php 1 file changed, 2 insertions(+), 4 deletions(-) Approvals: Jeroen De Dauw: Looks good to me, approved jenkins-bot: Verified diff --git a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php index b137639..8a73e03 100644 --- a/repo/tests/phpunit/includes/api/SetSiteLinkTest.php +++ b/repo/tests/phpunit/includes/api/SetSiteLinkTest.php @@ -254,9 +254,7 @@ ); $this-assertArrayHasKey( 'badges', $sitelink ); - $this-assertArrayEquals( $expSitelink['badges'], $sitelink['badges'], - Returned incorrect badges - ); + $this-assertArrayEquals( $expSitelink['badges'], $sitelink['badges'] ); } else if ( empty( $expected['value'] ) ) { $this-assertArrayHasKey( 'removed', $sitelink, Entity doesn't return expected 'removed' marker @@ -342,5 +340,5 @@ $warning = $result['warnings']['wbsetsitelink']['*']; $this-assertRegExp( /Unrecognized value for parameter 'badges'/, $warning ); } -} +} -- To view, visit https://gerrit.wikimedia.org/r/157147 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie8934df2da349cd25e94c2825ce4368cf98731ec Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Attempt to fix bug 70041 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Attempt to fix bug 70041 .. Attempt to fix bug 70041 Change-Id: Ib997a2bb6ffd10e4b51cc1b7ce5e793b83a0c93d --- M repo/tests/phpunit/includes/api/RemoveClaimsTest.php 1 file changed, 3 insertions(+), 1 deletion(-) Approvals: WikidataJenkins: Verified Thiemo Mättig (WMDE): Looks good to me, approved jenkins-bot: Checked diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php index a109771..f1a5227 100644 --- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php +++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php @@ -89,6 +89,8 @@ * @param Entity $entity */ public function doTestValidRequestSingle( Entity $entity ) { + $obtainedClaims = null; + /** * @var Claim[] $claims */ @@ -106,7 +108,7 @@ $this-assertTrue( $obtainedClaims-getHash() === $currentClaims-getHash() ); } - $this-assertTrue( $obtainedClaims-isEmpty() ); + $this-assertTrue( $obtainedClaims === null || $obtainedClaims-isEmpty() ); } /** -- To view, visit https://gerrit.wikimedia.org/r/156296 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib997a2bb6ffd10e4b51cc1b7ce5e793b83a0c93d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make ChangeOpClaimTest compatible with DM 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make ChangeOpClaimTest compatible with DM 1.0 .. Make ChangeOpClaimTest compatible with DM 1.0 Change-Id: Ifae7772d3ee2ef280092728ce201bbe0b6ce71b8 --- M repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php 1 file changed, 85 insertions(+), 88 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php index 0e983bb..9ba00df 100644 --- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php +++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpClaimTest.php @@ -6,7 +6,6 @@ use DataValues\StringValue; use InvalidArgumentException; use Wikibase\ChangeOp\ChangeOpClaim; -use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\ClaimGuidParser; use Wikibase\DataModel\Claim\Claims; use Wikibase\DataModel\Claim\Statement; @@ -82,61 +81,61 @@ public function provideTestApply() { $itemEmpty = Item::newEmpty(); $itemEmpty-setId( new ItemId( 'q888' ) ); - $item777 = self::makeNewItemWithClaim( 'Q777', new PropertyNoValueSnak( 45 ) ); - $item666 = self::makeNewItemWithClaim( 'Q666', new PropertySomeValueSnak( 44 ) ); + $item777 = self::makeNewItemWithStatement( 'Q777', new PropertyNoValueSnak( 45 ) ); + $item666 = self::makeNewItemWithStatement( 'Q666', new PropertySomeValueSnak( 44 ) ); - $item777Claims = $item777-getClaims(); - $item666Claims = $item666-getClaims(); + $item777Statements = $item777-getClaims(); + $item666Statements = $item666-getClaims(); - $claim777 = reset( $item777Claims ); - $claim666 = reset( $item666Claims ); + $statement777 = reset( $item777Statements ); + $statement666 = reset( $item666Statements ); //claims that exist on the given entities - $claims[0] = new Claim( new PropertyNoValueSnak( 43 ) ); - $claims[777] = clone $claim777; - $claims[666] = clone $claim666; + $statements[0] = new Statement( new PropertyNoValueSnak( 43 ) ); + $statements[777] = clone $statement777; + $statements[666] = clone $statement666; //claims with a null guid - $claims[7770] = clone $claim777; - $claims[7770]-setGuid( null ); - $claims[6660] = clone $claim666; - $claims[6660]-setGuid( null ); + $statements[7770] = clone $statement777; + $statements[7770]-setGuid( null ); + $statements[6660] = clone $statement666; + $statements[6660]-setGuid( null ); //new claims not yet on the entity - $claims[] = clone $claim777; - $claims[]-setGuid( 'Q777$D8404CDA-25E4-4334-AF13-A3290BC7' ); - $claims[] = clone $claim666; - $claims[]-setGuid( 'Q666$D8404CDA-25E4-4334-AF13-A3290BC6' ); + $statements[] = clone $statement777; + $statements[]-setGuid( 'Q777$D8404CDA-25E4-4334-AF13-A3290BC7' ); + $statements[] = clone $statement666; + $statements[]-setGuid( 'Q666$D8404CDA-25E4-4334-AF13-A3290BC6' ); - $claims[11] = new Claim( new PropertyNoValueSnak( 1 ) ); - $claims[11]-setGuid( null ); - $claims[12] = new Claim( new PropertySomeValueSnak( 1 ) ); - $claims[12]-setGuid( null ); - $claims[13] = clone $claims[12]; - $claims[13]-setGuid( 'Q666$D8404CDA-25E4-4334-AF13-A3290BC66613' ); + $statements[11] = new Statement( new PropertyNoValueSnak( 1 ) ); + $statements[11]-setGuid( null ); + $statements[12] = new Statement( new PropertySomeValueSnak( 1 ) ); + $statements[12]-setGuid( null ); + $statements[13] = clone $statements[12]; + $statements[13]-setGuid( 'Q666$D8404CDA-25E4-4334-AF13-A3290BC66613' ); $args = array(); //test adding claims with guids from other items(these shouldn't be added) - $args[] = array( $itemEmpty, $claims[666], false ); - $args[] = array( $itemEmpty, $claims[777], false ); - $args[] = array( $item666, $claims[777], false ); - $args[] = array( $item777, $claims[666], false ); + $args[] = array( $itemEmpty, $statements[666], false ); + $args[] = array( $itemEmpty, $statements[777], false ); + $args[] = array( $item666, $statements[777],
[MediaWiki-commits] [Gerrit] Replace some assert() with actual code - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Replace some assert() with actual code .. Replace some assert() with actual code This is related to the planned HHVM switch. assert() depends on a setting. It may do nothing but should in these cases. Change-Id: Ic5548eba2e0b673bd5c937bfc8c7c82915de014c --- M lib/includes/ChangesTable.php M lib/includes/EntityRetrievingDataTypeLookup.php M lib/includes/serializers/ClaimSerializer.php M lib/includes/store/ChunkCache.php M lib/includes/store/sql/PropertyInfoTable.php M lib/includes/store/sql/SiteLinkTable.php 6 files changed, 43 insertions(+), 27 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/lib/includes/ChangesTable.php b/lib/includes/ChangesTable.php index a4a8c2f..0f63910 100644 --- a/lib/includes/ChangesTable.php +++ b/lib/includes/ChangesTable.php @@ -1,6 +1,7 @@ ?php namespace Wikibase; + use IORMRow; use MWException; @@ -54,7 +55,7 @@ * @return string */ public function getRowClass() { - return '\Wikibase\ChangeRow'; + return 'Wikibase\ChangeRow'; } /** @@ -117,11 +118,10 @@ * * @param ChangeRow|IORMRow $row * +* @throws MWException * @return array */ protected function getWriteValues( IORMRow $row ) { - assert( $row instanceof ChangeRow ); - $values = parent::getWriteValues( $row ); $infoField = $this-getPrefixedField( 'info' ); @@ -129,6 +129,10 @@ $userIdField = $this-getPrefixedField( 'user_id' ); if ( isset( $values[$infoField] ) ) { + if ( !( $row instanceof ChangeRow ) ) { + throw new MWException( '$row must be a ChangeRow.' ); + } + $values[$infoField] = $row-serializeInfo( $values[$infoField] ); } @@ -181,4 +185,5 @@ /* @var Change $rec */ return $rec-getId(); } + } diff --git a/lib/includes/EntityRetrievingDataTypeLookup.php b/lib/includes/EntityRetrievingDataTypeLookup.php index 7cd9d55..6413682 100644 --- a/lib/includes/EntityRetrievingDataTypeLookup.php +++ b/lib/includes/EntityRetrievingDataTypeLookup.php @@ -44,11 +44,10 @@ private function getProperty( PropertyId $propertyId ) { $property = $this-entityLookup-getEntity( $propertyId ); - if ( $property === null ) { + if ( !( $property instanceof Property ) ) { throw new PropertyNotFoundException( $propertyId ); } - assert( $property instanceof Property ); return $property; } diff --git a/lib/includes/serializers/ClaimSerializer.php b/lib/includes/serializers/ClaimSerializer.php index c88c9c9..822c0e5 100644 --- a/lib/includes/serializers/ClaimSerializer.php +++ b/lib/includes/serializers/ClaimSerializer.php @@ -115,10 +115,10 @@ $serialization['qualifiers'] = $qualifiers; $serialization['qualifiers-order'] = array(); + /** @var Snak $snak */ foreach( $claim-getQualifiers() as $snak ) { - /** @var Snak $snak $id */ $id = $snak-getPropertyId()-getPrefixedId(); - if( !in_array( $id, $serialization['qualifiers-order'] ) ) { + if ( !in_array( $id, $serialization['qualifiers-order'] ) ) { $serialization['qualifiers-order'][] = $snak-getPropertyId()-getPrefixedId(); } } @@ -170,7 +170,7 @@ * @return ByPropertyListSerializer|ListSerializer */ private function getListSerializer() { - if( in_array( 'qualifiers', $this-options-getOption( SerializationOptions::OPT_GROUP_BY_PROPERTIES ) ) ){ + if ( in_array( 'qualifiers', $this-options-getOption( SerializationOptions::OPT_GROUP_BY_PROPERTIES ) ) ) { return new ByPropertyListSerializer( 'qualifiers', $this-snakSerializer, @@ -227,7 +227,7 @@ $claim = new Claim( $mainSnak ); } - if( array_key_exists( 'id', $serialization ) ){ + if ( array_key_exists( 'id', $serialization ) ) { $claim-setGuid( $serialization['id'] ); } @@ -238,9 +238,6 @@ throw new InvalidArgumentException( 'Invalid statement rank provided' ); } -
[MediaWiki-commits] [Gerrit] Attempt to fix bug 70041 - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/156296 Change subject: Attempt to fix bug 70041 .. Attempt to fix bug 70041 Change-Id: Ib997a2bb6ffd10e4b51cc1b7ce5e793b83a0c93d --- M repo/tests/phpunit/includes/api/RemoveClaimsTest.php 1 file changed, 3 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/96/156296/1 diff --git a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php index a109771..f1a5227 100644 --- a/repo/tests/phpunit/includes/api/RemoveClaimsTest.php +++ b/repo/tests/phpunit/includes/api/RemoveClaimsTest.php @@ -89,6 +89,8 @@ * @param Entity $entity */ public function doTestValidRequestSingle( Entity $entity ) { + $obtainedClaims = null; + /** * @var Claim[] $claims */ @@ -106,7 +108,7 @@ $this-assertTrue( $obtainedClaims-getHash() === $currentClaims-getHash() ); } - $this-assertTrue( $obtainedClaims-isEmpty() ); + $this-assertTrue( $obtainedClaims === null || $obtainedClaims-isEmpty() ); } /** -- To view, visit https://gerrit.wikimedia.org/r/156296 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib997a2bb6ffd10e4b51cc1b7ce5e793b83a0c93d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove dead code - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove dead code .. Remove dead code Change-Id: I92767025aff7ac7642d0eded75d3b1d0bd026f73 --- M lib/maintenance/dispatchChanges.php 1 file changed, 1 insertion(+), 13 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/lib/maintenance/dispatchChanges.php b/lib/maintenance/dispatchChanges.php index e864476..4028a59 100644 --- a/lib/maintenance/dispatchChanges.php +++ b/lib/maintenance/dispatchChanges.php @@ -960,20 +960,8 @@ wfProfileOut( __METHOD__ . '#job' ); wfProfileIn( __METHOD__ . '#push' ); - $result = $qgroup-push( $job ); + $qgroup-push( $job ); wfProfileOut( __METHOD__ . '#push' ); - - // MediaWiki 1.24+ throws exceptions on error instead of returning false, - // but JobQueueGroup::push returns a useless true value. - // - // We do explicit check for false, for backwards compatibility with MediaWiki 1.23 - // and to make robust in case the useless true return value is removed in core. - // - // @todo The check can be removed when we do not support 1.23 anymore. - if ( $result === false ) { - wfProfileOut( __METHOD__ ); - throw new \MWException( Failed to push to job queue for $wikiDB ); - } $this-trace( Posted notification job for site $siteID with . count( $changes ) . changes to $wikiDB. ); -- To view, visit https://gerrit.wikimedia.org/r/156112 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I92767025aff7ac7642d0eded75d3b1d0bd026f73 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Kill all the aliases - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Kill all the aliases .. Kill all the aliases ... when possible. It's not possible in classes that are directly in the Wikibase namespace. Change-Id: I8298d04f8af1fa588dbdf17f4bd1b4d45337 --- M client/includes/WikibaseClient.php M client/tests/phpunit/includes/ChangeHandlerTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php M docs/options.wiki M lib/includes/EntityFactory.php M lib/includes/changes/EntityChange.php M lib/includes/formatters/DispatchingSnakFormatter.php M lib/includes/formatters/MessageSnakFormatter.php M lib/includes/formatters/PropertyValueSnakFormatter.php M lib/includes/formatters/SnakFormatter.php M lib/includes/serializers/ClaimSerializer.php M lib/includes/serializers/ClaimsSerializer.php M lib/includes/serializers/DispatchingEntitySerializer.php M lib/includes/serializers/EntitySerializer.php M lib/includes/serializers/ItemSerializer.php M lib/includes/serializers/PropertySerializer.php M lib/includes/serializers/ReferenceSerializer.php M lib/includes/serializers/SerializerFactory.php M lib/includes/serializers/SnakSerializer.php M lib/includes/store/EntityContentDataCodec.php M lib/tests/phpunit/ChangesTableTest.php M lib/tests/phpunit/MockRepositoryTest.php M lib/tests/phpunit/PropertyInfoDataTypeLookupTest.php M lib/tests/phpunit/ReferencedEntitiesFinderTest.php M lib/tests/phpunit/ReferencedUrlFinderTest.php M lib/tests/phpunit/SnakConstructionServiceTest.php M lib/tests/phpunit/SnakFactoryTest.php M lib/tests/phpunit/TermTest.php M lib/tests/phpunit/Validators/EntityExistsValidatorTest.php M lib/tests/phpunit/WikibaseDataTypeBuildersTest.php M lib/tests/phpunit/changes/EntityChangeTest.php M lib/tests/phpunit/changes/TestChanges.php M lib/tests/phpunit/entity/EntityFactoryTest.php M lib/tests/phpunit/formatters/DispatchingSnakFormatterTest.php M lib/tests/phpunit/formatters/EntityIdLabelFormatterTest.php M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php M lib/tests/phpunit/formatters/MessageSnakFormatterTest.php M lib/tests/phpunit/formatters/WikibaseSnakFormatterBuildersTest.php M lib/tests/phpunit/serializers/ByPropertyListSerializerTest.php M lib/tests/phpunit/serializers/ByPropertyListUnserializerTest.php M lib/tests/phpunit/serializers/ClaimSerializerTest.php M lib/tests/phpunit/serializers/ClaimsSerializerTest.php M lib/tests/phpunit/serializers/EntitySerializerBaseTest.php M lib/tests/phpunit/serializers/ItemSerializerTest.php M lib/tests/phpunit/serializers/ListSerializerTest.php M lib/tests/phpunit/serializers/ListUnserializerTest.php M lib/tests/phpunit/serializers/PropertySerializerTest.php M lib/tests/phpunit/serializers/ReferenceSerializerTest.php M lib/tests/phpunit/serializers/SerializerFactoryTest.php M lib/tests/phpunit/serializers/SnakSerializerTest.php M lib/tests/phpunit/store/MockPropertyInfoStore.php M lib/tests/phpunit/store/MockTermIndex.php M lib/tests/phpunit/store/SqlEntityInfoBuilderTest.php M lib/tests/phpunit/store/TermPropertyLabelResolverTest.php M repo/includes/ClaimHtmlGenerator.php M repo/includes/EntitySearchTextGenerator.php M repo/includes/ItemSearchTextGenerator.php M repo/includes/ItemView.php M repo/includes/PropertyView.php M repo/includes/api/EditEntity.php M repo/includes/api/SetClaim.php M repo/includes/api/SetReference.php M repo/maintenance/importInterlang.php M repo/tests/phpunit/includes/ClaimDifferTest.php M repo/tests/phpunit/includes/ClaimDifferenceTest.php M repo/tests/phpunit/includes/ClaimDifferenceVisualizerTest.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/ClaimSummaryBuilderTest.php M repo/tests/phpunit/includes/ContentRetrieverTest.php M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php M repo/tests/phpunit/includes/EntitySearchTextGeneratorTest.php M repo/tests/phpunit/includes/EntityViewTest.php M repo/tests/phpunit/includes/ItemViewTest.php M repo/tests/phpunit/includes/PropertyViewTest.php M repo/tests/phpunit/includes/SummaryFormatterTest.php M repo/tests/phpunit/includes/Validators/SnakValidatorTest.php M repo/tests/phpunit/includes/View/SnakHtmlGeneratorTest.php M repo/tests/phpunit/includes/actions/ActionTestCase.php M repo/tests/phpunit/includes/api/RemoveClaimsTest.php M repo/tests/phpunit/includes/api/SetClaimTest.php M repo/tests/phpunit/includes/api/SetClaimValueTest.php M repo/tests/phpunit/includes/api/SetQualifierTest.php M repo/tests/phpunit/includes/content/EntityContentTest.php M repo/tests/phpunit/includes/content/EntityHandlerTest.php M repo/tests/phpunit/includes/content/ItemContentTest.php M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php M
[MediaWiki-commits] [Gerrit] Move EntityPermissionChecker to repo, as not used elsewhere - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Move EntityPermissionChecker to repo, as not used elsewhere .. Move EntityPermissionChecker to repo, as not used elsewhere Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f --- R repo/includes/store/EntityPermissionChecker.php 1 file changed, 0 insertions(+), 0 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/lib/includes/store/EntityPermissionChecker.php b/repo/includes/store/EntityPermissionChecker.php similarity index 100% rename from lib/includes/store/EntityPermissionChecker.php rename to repo/includes/store/EntityPermissionChecker.php -- To view, visit https://gerrit.wikimedia.org/r/155895 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7c84508dfead8fdd4808b44b5e2481779ec8fe6f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Sort imports in WikibaseRepo class - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Sort imports in WikibaseRepo class .. Sort imports in WikibaseRepo class Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 --- M repo/includes/WikibaseRepo.php 1 file changed, 9 insertions(+), 9 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php index 2f23620..4f431fa 100644 --- a/repo/includes/WikibaseRepo.php +++ b/repo/includes/WikibaseRepo.php @@ -14,11 +14,6 @@ use StubObject; use ValueFormatters\FormatterOptions; use ValueFormatters\ValueFormatter; -use Wikibase\ItemHandler; -use Wikibase\PropertyHandler; -use Wikibase\Repo\Notifications\ChangeNotifier; -use Wikibase\Repo\Notifications\ChangeTransmitter; -use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\ChangeOp\ChangeOpFactoryProvider; use Wikibase\DataModel\Claim\ClaimGuidParser; use Wikibase\DataModel\Entity\BasicEntityIdParser; @@ -26,14 +21,14 @@ use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\Property; -use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\EntityContentFactory; +use Wikibase\EntityFactory; use Wikibase\InternalSerialization\DeserializerFactory; use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Store\EntityLookup; -use Wikibase\EntityFactory; +use Wikibase\ItemHandler; use Wikibase\LabelDescriptionDuplicateDetector; use Wikibase\LanguageFallbackChainFactory; +use Wikibase\Lib\Changes\EntityChangeFactory; use Wikibase\Lib\ClaimGuidGenerator; use Wikibase\Lib\ClaimGuidValidator; use Wikibase\Lib\DispatchingValueFormatter; @@ -50,14 +45,19 @@ use Wikibase\Lib\PropertyInfoDataTypeLookup; use Wikibase\Lib\SnakConstructionService; use Wikibase\Lib\SnakFormatter; +use Wikibase\Lib\Store\EntityContentDataCodec; +use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\WikibaseDataTypeBuilders; use Wikibase\Lib\WikibaseSnakFormatterBuilders; use Wikibase\Lib\WikibaseValueFormatterBuilders; -use Wikibase\Lib\Store\EntityContentDataCodec; use Wikibase\ParserOutputJsConfigBuilder; +use Wikibase\PropertyHandler; use Wikibase\ReferencedEntitiesFinder; use Wikibase\Repo\Localizer\ChangeOpValidationExceptionLocalizer; use Wikibase\Repo\Localizer\MessageParameterFormatter; +use Wikibase\Repo\Notifications\ChangeNotifier; +use Wikibase\Repo\Notifications\ChangeTransmitter; +use Wikibase\Repo\Notifications\DatabaseChangeTransmitter; use Wikibase\Repo\Notifications\DummyChangeTransmitter; use Wikibase\Settings; use Wikibase\SettingsArray; -- To view, visit https://gerrit.wikimedia.org/r/155894 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Id829080070034240fb3346133b7cdf9c734842b7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Drop 5.3 repo only travis build (in German) - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Drop 5.3 repo only travis build (in German) .. Drop 5.3 repo only travis build (in German) we run 5.3 on jenkins, so this is redundant. Change-Id: I381eba1533c849934a7297bc8d385d47d78f5924 --- M .travis.yml 1 file changed, 0 insertions(+), 2 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved jenkins-bot: Checked diff --git a/.travis.yml b/.travis.yml index 2370e97..c40cc2e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,6 @@ include: - env: DBTYPE=mysql LANG=de; MW=master WB=client php: 5.3 -- env: DBTYPE=sqlite LANG=de; MW=master WB=repo - php: 5.3 - env: DBTYPE=sqlite LANG=ar; MW=master WB=both php: 5.3 - env: DBTYPE=sqlite LANG=ru; MW=master WB=both -- To view, visit https://gerrit.wikimedia.org/r/10 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I381eba1533c849934a7297bc8d385d47d78f5924 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Tobias Gritschacher tobias.gritschac...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Replace dirname( __FILE__ ) with __DIR__ in extension instal... - change (mediawiki...SemanticSignup)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Replace dirname( __FILE__ ) with __DIR__ in extension installation file .. Replace dirname( __FILE__ ) with __DIR__ in extension installation file Change-Id: If1f99e429bbfe421f678fdbb6134976bc7a56149 --- M SemanticSignup.php 1 file changed, 11 insertions(+), 11 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/SemanticSignup.php b/SemanticSignup.php index c593988..45c2858 100644 --- a/SemanticSignup.php +++ b/SemanticSignup.php @@ -56,18 +56,18 @@ ); $wgMessagesDirs['SemanticSignup'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['SemanticSignup'] = dirname( __FILE__ ) . '/SemanticSignup.i18n.php'; -$wgExtensionMessagesFiles['SemanticSignupMagic'] = dirname( __FILE__ ) . '/SemanticSignup.i18n.magic.php'; -$wgExtensionMessagesFiles['SemanticSignupAlias'] = dirname( __FILE__ ) . '/SemanticSignup.i18n.aliases.php'; +$wgExtensionMessagesFiles['SemanticSignup'] = __DIR__ . '/SemanticSignup.i18n.php'; +$wgExtensionMessagesFiles['SemanticSignupMagic'] = __DIR__ . '/SemanticSignup.i18n.magic.php'; +$wgExtensionMessagesFiles['SemanticSignupAlias'] = __DIR__ . '/SemanticSignup.i18n.aliases.php'; -$wgAutoloadClasses['SemanticSignupSettings'] = dirname( __FILE__ ) . '/SemanticSignup.settings.php'; -$wgAutoloadClasses['SemanticSignupHooks'] = dirname( __FILE__ ) . '/SemanticSignup.hooks.php'; -$wgAutoloadClasses['SemanticSignup'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; -$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_Special.php'; -$wgAutoloadClasses['SES_DataChecker'] = dirname( __FILE__ ) . '/includes/SES_DataChecker.php'; -$wgAutoloadClasses['SES_UserAccountDataChecker'] = dirname( __FILE__ ) . '/includes/SES_UserAccountDataChecker.php'; -$wgAutoloadClasses['SES_SignupFields'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php'; -$wgAutoloadClasses['CreateUserFieldsTemplate'] = dirname( __FILE__ ) . '/includes/SES_SignupFields.php'; +$wgAutoloadClasses['SemanticSignupSettings'] = __DIR__ . '/SemanticSignup.settings.php'; +$wgAutoloadClasses['SemanticSignupHooks'] = __DIR__ . '/SemanticSignup.hooks.php'; +$wgAutoloadClasses['SemanticSignup'] = __DIR__ . '/includes/SES_Special.php'; +$wgAutoloadClasses['SES_UserAccountDataChecker'] = __DIR__ . '/includes/SES_Special.php'; +$wgAutoloadClasses['SES_DataChecker'] = __DIR__ . '/includes/SES_DataChecker.php'; +$wgAutoloadClasses['SES_UserAccountDataChecker'] = __DIR__ . '/includes/SES_UserAccountDataChecker.php'; +$wgAutoloadClasses['SES_SignupFields'] = __DIR__ . '/includes/SES_SignupFields.php'; +$wgAutoloadClasses['CreateUserFieldsTemplate'] = __DIR__ . '/includes/SES_SignupFields.php'; $wgSpecialPages['SemanticSignup'] = 'SemanticSignup'; -- To view, visit https://gerrit.wikimedia.org/r/145779 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: If1f99e429bbfe421f678fdbb6134976bc7a56149 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SemanticSignup Gerrit-Branch: master Gerrit-Owner: Withoutaname drevit...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Nischayn22 nischay...@gmail.com Gerrit-Reviewer: Yaron Koren yaro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Consolidate file header documentation for SemanticSignup.php - change (mediawiki...SemanticSignup)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Consolidate file header documentation for SemanticSignup.php .. Consolidate file header documentation for SemanticSignup.php Change-Id: Ife66ccf5fca5d1ac783828e6b93daa12fd6a64b5 --- M SemanticSignup.hooks.php M SemanticSignup.i18n.aliases.php M SemanticSignup.i18n.magic.php M SemanticSignup.php M SemanticSignup.settings.php M includes/SES_Special.php 6 files changed, 14 insertions(+), 16 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/SemanticSignup.hooks.php b/SemanticSignup.hooks.php index 4c99e0c..8a1fdd9 100644 --- a/SemanticSignup.hooks.php +++ b/SemanticSignup.hooks.php @@ -9,7 +9,7 @@ * @ingroup SemanticSignup * * @licence GNU GPL v3+ - * @author Jeroen De Dauw jeroended...@gmail.com + * @author Jeroen De Dauw jeroended...@gmail.com */ final class SemanticSignupHooks { diff --git a/SemanticSignup.i18n.aliases.php b/SemanticSignup.i18n.aliases.php index d57494e..5592195 100644 --- a/SemanticSignup.i18n.aliases.php +++ b/SemanticSignup.i18n.aliases.php @@ -8,7 +8,7 @@ * @ingroup SemanticSignup * * @author Serhii Kutnii - * @author Jeroen De Dauw jeroended...@gmail.com + * @author Jeroen De Dauw jeroended...@gmail.com */ // @codingStandardsIgnoreFile @@ -67,4 +67,4 @@ /** Traditional Chinese (中文(繁體)) */ $specialPageAliases['zh-hant'] = array( 'SemanticSignup' = array( '语义注册' ), -); \ No newline at end of file +); diff --git a/SemanticSignup.i18n.magic.php b/SemanticSignup.i18n.magic.php index ff47091..8bd2ed3 100644 --- a/SemanticSignup.i18n.magic.php +++ b/SemanticSignup.i18n.magic.php @@ -8,7 +8,7 @@ * @ingroup SemanticSignup * * @author Serhii Kutnii - * @author Jeroen De Dauw jeroended...@gmail.com + * @author Jeroen De Dauw jeroended...@gmail.com */ $magicWords = array(); diff --git a/SemanticSignup.php b/SemanticSignup.php index 45c2858..4be13fb 100644 --- a/SemanticSignup.php +++ b/SemanticSignup.php @@ -1,22 +1,20 @@ ?php /** * Initialization file for the Semantic Signup extension. + * This documenation group collects source code files belonging to SemanticSignup. * - * Documentation: http://www.mediawiki.org/wiki/Extension:SemanticSignup - * Support: http://www.mediawiki.org/wiki/Extension_talk:SemanticSignup - * Source code: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticSignup.git + * Documentation: https://www.mediawiki.org/wiki/Extension:SemanticSignup + * Support: https://www.mediawiki.org/wiki/Extension talk:SemanticSignup + * Source code: https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticSignup.git * * @file SemanticSignup.php + * @ingroup Extensions + * @defgroup SemanticSignup SemanticSignup * @ingroup SemanticSignup * * @licence GNU GPL v3+ - * @author Jeroen De Dauw jeroended...@gmail.com - */ - -/** - * This documenation group collects source code files belonging to SemanticSignup. - * - * @defgroup SemanticSignup SemanticSignup + * @link https://www.mediawiki.org/wiki/Extension:SemanticSignup + * @author Jeroen De Dauw jeroended...@gmail.com */ if ( !defined( 'MEDIAWIKI' ) ) { diff --git a/SemanticSignup.settings.php b/SemanticSignup.settings.php index 21f9060..9260394 100644 --- a/SemanticSignup.settings.php +++ b/SemanticSignup.settings.php @@ -13,7 +13,7 @@ * @ingroup SemanticSignup * * @licence GNU GPL v3+ - * @author Jeroen De Dauw jeroended...@gmail.com + * @author Jeroen De Dauw jeroended...@gmail.com */ class SemanticSignupSettings { diff --git a/includes/SES_Special.php b/includes/SES_Special.php index f217a7d..aa7adec 100644 --- a/includes/SES_Special.php +++ b/includes/SES_Special.php @@ -10,7 +10,7 @@ * @ingroup SemanticSignup * * @author Serhii Kutnii - * @author Jeroen De Dauw jeroended...@gmail.com + * @author Jeroen De Dauw jeroended...@gmail.com */ class SemanticSignup extends SpecialPage { -- To view, visit https://gerrit.wikimedia.org/r/145782 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ife66ccf5fca5d1ac783828e6b93daa12fd6a64b5 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/SemanticSignup Gerrit-Branch: master Gerrit-Owner: Withoutaname drevit...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Nischayn22 nischay...@gmail.com Gerrit-Reviewer: Yaron Koren yaro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Move CreateUserFieldsTemplate to a separate file - change (mediawiki...SemanticSignup)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Move CreateUserFieldsTemplate to a separate file .. Move CreateUserFieldsTemplate to a separate file Change-Id: I2521032ebd8b38950845d8050b4dc322e3467257 --- M SemanticSignup.php A includes/CreateUserFieldsTemplate.php M includes/SES_SignupFields.php 3 files changed, 155 insertions(+), 151 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/SemanticSignup.php b/SemanticSignup.php index f863371..868e82c 100644 --- a/SemanticSignup.php +++ b/SemanticSignup.php @@ -64,7 +64,7 @@ $wgAutoloadClasses['SES_DataChecker'] = __DIR__ . '/includes/SES_DataChecker.php'; $wgAutoloadClasses['SES_UserAccountDataChecker'] = __DIR__ . '/includes/SES_UserAccountDataChecker.php'; $wgAutoloadClasses['SES_SignupFields'] = __DIR__ . '/includes/SES_SignupFields.php'; -$wgAutoloadClasses['CreateUserFieldsTemplate'] = __DIR__ . '/includes/SES_SignupFields.php'; +$wgAutoloadClasses['CreateUserFieldsTemplate'] = __DIR__ . '/includes/CreateUserFieldsTemplate.php'; $wgSpecialPages['SemanticSignup'] = 'SpecialSemanticSignup'; diff --git a/includes/CreateUserFieldsTemplate.php b/includes/CreateUserFieldsTemplate.php new file mode 100644 index 000..61ab50a --- /dev/null +++ b/includes/CreateUserFieldsTemplate.php @@ -0,0 +1,154 @@ +?php +/** + * Created on 6 Jan 2009 by Serhii Kutnii + */ + +/** + * Borrowed from standard UsercreateTemplate. Some minor changes have been made + */ + +class CreateUserFieldsTemplate extends QuickTemplate { + + function addInputItem( $name, $value, $type, $msg ) { + $this-data['extraInput'][] = array( + 'name' = $name, + 'value' = $value, + 'type' = $type, + 'msg' = $msg, + ); + } + + function execute() { + global $sfgTabIndex; + + ? +div id=userlogin style=float:none; + + h2?php $this-msg( 'createaccount' ) ?/h2 + p id=userloginlink?php $this-html( 'link' ) ?/p + ?php $this-html( 'header' ); /* pre-table point for form plugins... */ ? + ?php if ( @$this-haveData( 'languages' ) ) { ?div id=languagelinksp?php $this-html( 'languages' ); ?/p/div?php } ? + table + tr + td class=mw-labellabel for='wpName2'?php $this-msg( 'yourname' ) ?/label/td + td class=mw-input + input type='text' class='loginText' name=wpName id=wpName2 + tabindex=?php echo $sfgTabIndex++; ? + size='20' / + /td + /tr + tr + td class=mw-labellabel for='wpPassword2'?php $this-msg( 'yourpassword' ) ?/label/td + td class=mw-input + input type='password' class='loginPassword' name=wpPassword id=wpPassword2 + tabindex=?php echo $sfgTabIndex++; ? + value= size='20' / + /td + /tr + ?php if ( $this-data['usedomain'] ) { + $doms = ; + foreach ( $this-data['domainnames'] as $dom ) { + $doms .= option . htmlspecialchars( $dom ) . /option; + } + ? + tr + td class=mw-label?php $this-msg( 'yourdomainname' ) ?/td + td class=mw-input + select name=wpDomain value=?php $this-text( 'domain' ) ? + tabindex=?php echo $sfgTabIndex++; ? + ?php echo $doms ? + /select + /td + /tr + ?php } ? + tr + td class=mw-labellabel for='wpRetype'?php $this-msg( 'yourpasswordagain' ) ?/label/td + td class=mw-input + input type='password' class='loginPassword' name=wpRetype id=wpRetype + tabindex=?php echo $sfgTabIndex++; ? + value= + size='20' / + /td + /tr + tr + ?php if ( $this-data['useemail'] ) { ? + td class=mw-labellabel for='wpEmail'?php $this-msg( 'youremail' ) ?/label/td + td class=mw-input + input type='text' class='loginText' name=wpEmail id=wpEmail + tabindex=?php echo $sfgTabIndex++; ? + value=?php $this-text(
[MediaWiki-commits] [Gerrit] Rename SES_Special to SpecialSemanticSignup - change (mediawiki...SemanticSignup)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Rename SES_Special to SpecialSemanticSignup .. Rename SES_Special to SpecialSemanticSignup Also updated file header documentation for the special page and removed a duplicate entry for SES_UserAccountDataChecker from $wgAutoloadClasses which originally pointed to the special page file. Change-Id: I70a3e70024e7dfbad95608c4f563aee626211bc0 --- M SemanticSignup.php R includes/SpecialSemanticSignup.php 2 files changed, 7 insertions(+), 9 deletions(-) Approvals: Jeroen De Dauw: Verified; Looks good to me, approved diff --git a/SemanticSignup.php b/SemanticSignup.php index 4be13fb..f863371 100644 --- a/SemanticSignup.php +++ b/SemanticSignup.php @@ -60,14 +60,13 @@ $wgAutoloadClasses['SemanticSignupSettings'] = __DIR__ . '/SemanticSignup.settings.php'; $wgAutoloadClasses['SemanticSignupHooks'] = __DIR__ . '/SemanticSignup.hooks.php'; -$wgAutoloadClasses['SemanticSignup'] = __DIR__ . '/includes/SES_Special.php'; -$wgAutoloadClasses['SES_UserAccountDataChecker'] = __DIR__ . '/includes/SES_Special.php'; +$wgAutoloadClasses['SpecialSemanticSignup'] = __DIR__ . '/includes/SpecialSemanticSignup.php'; $wgAutoloadClasses['SES_DataChecker'] = __DIR__ . '/includes/SES_DataChecker.php'; $wgAutoloadClasses['SES_UserAccountDataChecker'] = __DIR__ . '/includes/SES_UserAccountDataChecker.php'; $wgAutoloadClasses['SES_SignupFields'] = __DIR__ . '/includes/SES_SignupFields.php'; $wgAutoloadClasses['CreateUserFieldsTemplate'] = __DIR__ . '/includes/SES_SignupFields.php'; -$wgSpecialPages['SemanticSignup'] = 'SemanticSignup'; +$wgSpecialPages['SemanticSignup'] = 'SpecialSemanticSignup'; $egSemanticSignupSettings = array(); diff --git a/includes/SES_Special.php b/includes/SpecialSemanticSignup.php similarity index 95% rename from includes/SES_Special.php rename to includes/SpecialSemanticSignup.php index aa7adec..de15796 100644 --- a/includes/SES_Special.php +++ b/includes/SpecialSemanticSignup.php @@ -1,18 +1,17 @@ ?php /** - * Special page that replaces the regular signup form by - * a Semantic Forms form page that allows for signup with - * adittional (structured) data that immediately gets entered - * onto the user page of the new user. + * Special page to replace SpecialUserLogin/signup with an equivalent + * SemanticForms form page and allow for additional (structured) data + * to be collected on signup and used on the new user's userpage. * - * @file SES_Special.php + * @file SpecialSemanticSignup.php * @ingroup SemanticSignup * * @author Serhii Kutnii * @author Jeroen De Dauw jeroended...@gmail.com */ -class SemanticSignup extends SpecialPage { +class SpecialSemanticSignup extends SpecialPage { private $mUserDataChecker = null; private $mUserPageUrl = ''; -- To view, visit https://gerrit.wikimedia.org/r/145784 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I70a3e70024e7dfbad95608c4f563aee626211bc0 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/SemanticSignup Gerrit-Branch: master Gerrit-Owner: Withoutaname drevit...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Nischayn22 nischay...@gmail.com Gerrit-Reviewer: Yaron Koren yaro...@gmail.com Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Use DataModel 0.9.x - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/154339 Change subject: Use DataModel 0.9.x .. Use DataModel 0.9.x Change-Id: Ibf3d660c475a52871d2f9d2f993857b249b84f94 --- M composer.json 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/39/154339/1 diff --git a/composer.json b/composer.json index bdcdcbd..93a2d19 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~0.8.2, + wikibase/data-model: ~0.9.0, wikibase/data-model-javascript: ~0.3.0, wikibase/data-model-serialization: ~1.0.1, wikibase/internal-serialization: ~1.1, -- To view, visit https://gerrit.wikimedia.org/r/154339 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibf3d660c475a52871d2f9d2f993857b249b84f94 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update / remove references to TermCache interface - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Update / remove references to TermCache interface .. Update / remove references to TermCache interface TermCache has been renamed to TermIndex. Change-Id: I088f4408958a0c2d6339eecfb75c6e32a108c8ad --- M lib/includes/store/TermIndex.php M lib/includes/store/sql/TermSqlIndex.php 2 files changed, 10 insertions(+), 12 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/store/TermIndex.php b/lib/includes/store/TermIndex.php index 3b838c2..7f4ea0d 100644 --- a/lib/includes/store/TermIndex.php +++ b/lib/includes/store/TermIndex.php @@ -9,8 +9,6 @@ * * @licence GNU GPL v2+ * @author Jeroen De Dauw jeroended...@gmail.com - * - * @todo: rename to TermIndex */ interface TermIndex extends TermCombinationMatchFinder { diff --git a/lib/includes/store/sql/TermSqlIndex.php b/lib/includes/store/sql/TermSqlIndex.php index 7f0bf78..7973bd3 100644 --- a/lib/includes/store/sql/TermSqlIndex.php +++ b/lib/includes/store/sql/TermSqlIndex.php @@ -76,7 +76,7 @@ } /** -* @see TermCache::saveTermsOfEntity +* @see TermIndex::saveTermsOfEntity * * @since 0.1 * @@ -317,7 +317,7 @@ } /** -* @see TermCache::deleteTermsOfEntity +* @see TermIndex::deleteTermsOfEntity * * @since 0.5 * @@ -349,7 +349,7 @@ /** * Returns the terms stored for the given entity. -* @see TermCache::getTermsOfEntity +* @see TermIndex::getTermsOfEntity * * @param EntityId $id * @@ -390,7 +390,7 @@ /** * Returns the terms stored for the given entities. * -* @see TermCache::getTermsOfEntities +* @see TermIndex::getTermsOfEntities * * @param EntityId[] $ids * @param string $entityType @@ -475,7 +475,7 @@ } /** -* @see TermCache::termExists +* @see TermIndex::termExists * * @since 0.1 * @@ -524,7 +524,7 @@ } /** -* @see TermCache::getEntityIdsForLabel +* @see TermIndex::getEntityIdsForLabel * * @since 0.1 * @@ -585,7 +585,7 @@ } /** -* @see TermCache::getMatchingTerms +* @see TermIndex::getMatchingTerms * * @since 0.2 * @@ -634,7 +634,7 @@ } /** -* @see TermCache::getMatchingIDs +* @see TermIndex::getMatchingIDs * * @since 0.4 * @@ -866,7 +866,7 @@ } /** -* @see TermCache::clear +* @see TermIndex::clear * * @since 0.2 * @@ -880,7 +880,7 @@ } /** -* @see TermCache::getMatchingTermCombination +* @see TermIndex::getMatchingTermCombination * * Note: the interface specifies capability for only a single join, which in this implementation * is enforced by the $joinCount var. The code itself however could handle multiple joins. -- To view, visit https://gerrit.wikimedia.org/r/152056 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I088f4408958a0c2d6339eecfb75c6e32a108c8ad Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Handle MonolingualTextParser errors for values with language... - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Handle MonolingualTextParser errors for values with language not set .. Handle MonolingualTextParser errors for values with language not set Throw a ParseException and then the api response can handle that, providing appropriate error response. Bug: 69608 Change-Id: I010fc0902372e6677319dbbbcfd649d9d01d1b9d --- M lib/includes/parsers/MonolingualTextParser.php M lib/tests/phpunit/parsers/MonolingualTextParserTest.php 2 files changed, 10 insertions(+), 5 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/parsers/MonolingualTextParser.php b/lib/includes/parsers/MonolingualTextParser.php index 7f74188..22a1ab4 100644 --- a/lib/includes/parsers/MonolingualTextParser.php +++ b/lib/includes/parsers/MonolingualTextParser.php @@ -4,6 +4,7 @@ use DataValues\IllegalValueException; use DataValues\MonolingualTextValue; +use ValueParsers\ParseException; use ValueParsers\StringValueParser; /** @@ -26,17 +27,21 @@ * * @param string $value * -* @throws IllegalValueException if the valuelang option is missing or empty +* @throws ParseException if the valuelang option is missing or empty * @return MonolingualTextValue */ protected function stringParse( $value ) { if ( !$this-getOptions()-hasOption( 'valuelang' ) ) { - throw new IllegalValueException( 'Can not construct a MonolingualTextValue without a language code.' ); + throw new ParseException( 'Cannot construct a MonolingualTextValue without a language code.' ); } $lang = $this-getOptions()-getOption( 'valuelang' ); - return new MonolingualTextValue( trim( $lang ), trim( $value ) ); + try { + return new MonolingualTextValue( trim( $lang ), trim( $value ) ); + } catch ( IllegalValueException $ex ) { + throw new ParseException( $ex-getMessage() ); + } } } diff --git a/lib/tests/phpunit/parsers/MonolingualTextParserTest.php b/lib/tests/phpunit/parsers/MonolingualTextParserTest.php index 151f65c..30d4310 100644 --- a/lib/tests/phpunit/parsers/MonolingualTextParserTest.php +++ b/lib/tests/phpunit/parsers/MonolingualTextParserTest.php @@ -43,7 +43,7 @@ } /** -* @expectedException \DataValues\IllegalValueException +* @expectedException \ValueParsers\ParseException */ public function testParse_missingLanguageOption() { $parser = new MonolingualTextParser(); @@ -59,7 +59,7 @@ /** * @dataProvider invalidLanguageCodeProvider -* @expectedException \DataValues\IllegalValueException +* @expectedException \ValueParsers\ParseException */ public function testParse_invalidLanguageOption( $languageCode ) { $options = new ParserOptions( array( 'valuelang' = $languageCode ) ); -- To view, visit https://gerrit.wikimedia.org/r/154277 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I010fc0902372e6677319dbbbcfd649d9d01d1b9d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Aude aude.w...@gmail.com Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Do not +2 on verified based just on linting - change (integration/zuul-config)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/154058 Change subject: Do not +2 on verified based just on linting .. Do not +2 on verified based just on linting Change-Id: I75408d59ddf8e4702a32cfc9cb753a96dd339c55 --- M layout.yaml 1 file changed, 0 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/integration/zuul-config refs/changes/58/154058/1 diff --git a/layout.yaml b/layout.yaml index 8e091b6..1e4181e 100644 --- a/layout.yaml +++ b/layout.yaml @@ -5534,10 +5534,6 @@ - mwext-Wikibase-jslint - mwext-Wikibase-lint - php-composer-validate -gate-and-submit: - - mwext-Wikibase-jslint - - mwext-Wikibase-lint - - php-composer-validate - name: mediawiki/extensions/WikibaseQuery template: -- To view, visit https://gerrit.wikimedia.org/r/154058 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I75408d59ddf8e4702a32cfc9cb753a96dd339c55 Gerrit-PatchSet: 1 Gerrit-Project: integration/zuul-config Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Refactor Fingerprint code out of EntityView - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Refactor Fingerprint code out of EntityView .. Refactor Fingerprint code out of EntityView All code related to fingerprint is moved into a separate FingerprintView which only knows about a fingerprint and an entity id. This helps us getting rid of EntityView at one point. Change-Id: Ib932282be071c20455045f32e60f0244c4623980 --- M repo/includes/EntityView.php M repo/includes/PropertyView.php A repo/includes/View/FingerprintView.php M repo/includes/View/TermBoxView.php M repo/tests/phpunit/includes/EntityViewTest.php A repo/tests/phpunit/includes/View/FingerprintViewTest.php 6 files changed, 313 insertions(+), 184 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/EntityView.php b/repo/includes/EntityView.php index d048b95..14509a4 100644 --- a/repo/includes/EntityView.php +++ b/repo/includes/EntityView.php @@ -12,6 +12,7 @@ use Wikibase\Lib\Serializers\SerializationOptions; use Wikibase\Lib\SnakFormatter; use Wikibase\Lib\Store\EntityInfoBuilderFactory; +use Wikibase\Repo\View\FingerprintView; use Wikibase\Repo\View\SectionEditLinkGenerator; use Wikibase\Repo\View\SnakHtmlGenerator; use Wikibase\Repo\View\TextInjector; @@ -29,6 +30,7 @@ * @author H. Snater mediawiki at snater.com * @author Daniel Werner * @author Daniel Kinzler + * @author Bene* benestar.wikime...@gmail.com */ abstract class EntityView extends ContextSource { @@ -230,12 +232,7 @@ $html = ''; - $html .= $this-getHtmlForLabel( $entity, $editable ); - $html .= $this-getHtmlForDescription( $entity, $editable ); - - $html .= wfTemplate( 'wb-entity-header-separator' ); - - $html .= $this-getHtmlForAliases( $entity, $editable ); + $html .= $this-getHtmlForFingerprint( $entity, $editable ); $html .= $this-getHtmlForToc(); $html .= $this-getHtmlForTermBox( $entityRevision, $editable ); $html .= $this-getHtmlForClaims( $entity, $editable ); @@ -245,7 +242,19 @@ } /** -* Builds and returns the html for the toc. +* Builds and returns the HTML for the entity's fingerprint. +* +* @param Entity $entity +* @param bool $editable +* @return string +*/ + protected function getHtmlForFingerprint( Entity $entity, $editable = true ) { + $fingerprintView = new FingerprintView( $this-sectionEditLinkGenerator, $this-getLanguage()-getCode() ); + return $fingerprintView-getHtml( $entity-getFingerprint(), $entity-getId(), $editable ); + } + + /** +* Builds and returns the HTML for the toc. * * @return string */ @@ -383,128 +392,6 @@ wfProfileOut( __METHOD__ ); return $pout; - } - - /** -* Builds and returns the HTML representing a WikibaseEntity's label. -* -* @since 0.1 -* -* @param Entity $entity the entity to render -* @param bool $editable whether editing is allowed (enabled edit links) -* @return string -*/ - public function getHtmlForLabel( Entity $entity, $editable = true ) { - wfProfileIn( __METHOD__ ); - - $languageCode = $this-getLanguage()-getCode(); - $label = $entity-getLabel( $languageCode ); - $entityId = $entity-getId(); - $idString = 'new'; - $supplement = ''; - - if ( $entityId !== null ) { - $idString = $entityId-getSerialization(); - $supplement .= wfTemplate( 'wb-property-value-supplement', wfMessage( 'parentheses', $idString ) ); - if ( $editable ) { - $supplement .= $this-getHtmlForEditSection( 'SetLabel', array( $idString, $languageCode ) ); - } - } - - $html = wfTemplate( 'wb-label', - $idString, - wfTemplate( 'wb-property', - $label === false ? 'wb-value-empty' : '', - htmlspecialchars( $label === false ? wfMessage( 'wikibase-label-empty' )-text() : $label ), - $supplement - ) - ); - - wfProfileOut( __METHOD__ ); - return $html; - } - - /** -* Builds and returns the HTML representing a WikibaseEntity's description. -* -* @since 0.1 -* -* @param Entity $entity the entity to render -* @param bool $editable whether editing is allowed (enabled edit links) -* @return string -*/ -
[MediaWiki-commits] [Gerrit] Fix EntityHandlerTest with the new serialization format - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Fix EntityHandlerTest with the new serialization format .. Fix EntityHandlerTest with the new serialization format Change-Id: I2f268584f78d854832de63a324c4c8813eca4b76 --- M repo/tests/phpunit/includes/content/EntityHandlerTest.php M repo/tests/phpunit/includes/content/ItemHandlerTest.php 2 files changed, 11 insertions(+), 9 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/content/EntityHandlerTest.php b/repo/tests/phpunit/includes/content/EntityHandlerTest.php index 4cdc3a0..de28353 100644 --- a/repo/tests/phpunit/includes/content/EntityHandlerTest.php +++ b/repo/tests/phpunit/includes/content/EntityHandlerTest.php @@ -15,7 +15,6 @@ use Wikibase\InternalSerialization\SerializerFactory; use Wikibase\Lib\Serializers\LegacyInternalEntitySerializer; use Wikibase\Lib\Store\EntityRedirect; -use Wikibase\Lib\Store\EntityContentDataCodec; use Wikibase\Repo\WikibaseRepo; use Wikibase\SettingsArray; @@ -357,12 +356,16 @@ $legacySerializer = new LegacyInternalEntitySerializer(); $oldBlob = json_encode( $legacySerializer-serialize( $entity ) ); - // replace entity:[item,7] with entity:q7 + // fake several old formats + $type = $entity-getType(); $id = $entity-getId()-getSerialization(); - $veryOldBlob = preg_replace( '/entity:\[\w+,\d+\]/', 'entity:' . strtolower( $id ) . '', $oldBlob ); + // replace type:item,id:q7 with entity:[item,7] + $veryOldBlob = preg_replace( '/type:\w+,id:\w\d+/', 'entity:[' . strtolower( $type ) . ',' . substr( $id, 1 ) . ']', $oldBlob ); + // replace entity:[item,7] with entity:q7 + $veryVeryOldBlob = preg_replace( '/entity:\[\w+,\d+\]/', 'entity:' . strtolower( $id ) . '', $veryOldBlob ); - // sanity - if ( $oldBlob == $veryOldBlob ) { + // sanity (cannot compare $veryOldBlob and $oldBlob until we have the new serialization in place) + if ( $veryVeryOldBlob == $veryOldBlob /* || $veryOldBlob == $oldBlob */ ) { throw new RuntimeException( 'Failed to fake very old serialization format based on oldish serialization format.' ); } @@ -372,8 +375,9 @@ $newBlob = json_encode( $newSerializer-serialize( $entity ) ); return array( - 'old serialization / ancient id format' = array( $veryOldBlob, $newBlob ), - 'old serialization / new silly id format' = array( $oldBlob, $newBlob ), + 'old serialization / ancient id format' = array( $veryVeryOldBlob, $newBlob ), + 'old serialization / new silly id format' = array( $veryOldBlob, $newBlob ), + 'old serialization / old serializer format' = array( $oldBlob, $newBlob ), 'new serialization format, keep as is' = array( $newBlob, $newBlob ), ); } diff --git a/repo/tests/phpunit/includes/content/ItemHandlerTest.php b/repo/tests/phpunit/includes/content/ItemHandlerTest.php index cd21434..590850e 100644 --- a/repo/tests/phpunit/includes/content/ItemHandlerTest.php +++ b/repo/tests/phpunit/includes/content/ItemHandlerTest.php @@ -10,9 +10,7 @@ use Wikibase\EntityContent; use Wikibase\ItemContent; use Wikibase\ItemHandler; -use Wikibase\Lib\Store\EntityContentDataCodec; use Wikibase\Lib\Store\EntityRedirect; -use Wikibase\Repo\WikibaseRepo; use Wikibase\SettingsArray; /** -- To view, visit https://gerrit.wikimedia.org/r/153844 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2f268584f78d854832de63a324c4c8813eca4b76 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Bene benestar.wikime...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make PropertyContentTest work with DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make PropertyContentTest work with DataModel 1.0 .. Make PropertyContentTest work with DataModel 1.0 In DataModel 1.0 Properties do not contain claims any more so we have to move all claim related stuff into the ItemHandlerTest. Change-Id: Ib3d761912e5721e63d14e4565c8a272ab4164f50 --- M repo/tests/phpunit/includes/content/EntityContentTest.php M repo/tests/phpunit/includes/content/ItemContentTest.php 2 files changed, 31 insertions(+), 21 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/repo/tests/phpunit/includes/content/EntityContentTest.php b/repo/tests/phpunit/includes/content/EntityContentTest.php index e175c59..90ed889 100644 --- a/repo/tests/phpunit/includes/content/EntityContentTest.php +++ b/repo/tests/phpunit/includes/content/EntityContentTest.php @@ -167,16 +167,6 @@ array( 'wb-status' = EntityContent::STATUS_STUB, 'wb-claims' = 0 ) ); - $contentWithClaim = $this-newEmpty(); - $claim = new Statement( new PropertyNoValueSnak( 83 ) ); - $claim-setGuid( '$testing$' ); - $contentWithClaim-getEntity()-addClaim( $claim ); - - $cases['claims'] = array( - $contentWithClaim, - array( 'wb-claims' = 1 ) - ); - return $cases; } @@ -197,11 +187,6 @@ $contentWithLabel = $this-newEmpty(); $contentWithLabel-getEntity()-setLabel( 'de', 'xyz' ); - $contentWithClaim = $this-newEmpty(); - $claim = new Statement( new PropertyNoValueSnak( 83 ) ); - $claim-setGuid( '$testing$' ); - $contentWithClaim-getEntity()-addClaim( $claim ); - return array( 'empty' = array( $this-newEmpty(), @@ -210,10 +195,6 @@ 'labels' = array( $contentWithLabel, EntityContent::STATUS_STUB - ), - 'claims' = array( - $contentWithClaim, - EntityContent::STATUS_NONE ), ); } diff --git a/repo/tests/phpunit/includes/content/ItemContentTest.php b/repo/tests/phpunit/includes/content/ItemContentTest.php index a980d4a..7d3e07e 100644 --- a/repo/tests/phpunit/includes/content/ItemContentTest.php +++ b/repo/tests/phpunit/includes/content/ItemContentTest.php @@ -94,6 +94,18 @@ array( 'wb-claims' = 0, 'wb-sitelinks' = 1 ) ); + // @todo this is needed in PropertyContentTest as well + // once we have statements in properties + $contentWithClaim = $this-newEmpty(); + $claim = new Statement( new PropertyNoValueSnak( 83 ) ); + $claim-setGuid( '$testing$' ); + $contentWithClaim-getEntity()-addClaim( $claim ); + + $cases['claims'] = array( + $contentWithClaim, + array( 'wb-claims' = 1 ) + ); + return $cases; } @@ -116,8 +128,25 @@ ItemContent::STATUS_LINKSTUB ); - $cases['statements and links'] = $cases['claims']; // from parent::provideGetEntityStatus(); - $cases['statements and links'][0]-getEntity()-getSiteLinkList()-addNewSiteLink( 'enwiki', 'Foo' ); + // @todo this is needed in PropertyContentTest as well + // once we have statements in properties + $contentWithClaim = $this-newEmpty(); + $claim = new Statement( new PropertyNoValueSnak( 83 ) ); + $claim-setGuid( '$testing$' ); + $contentWithClaim-getEntity()-addClaim( $claim ); + + $cases['claims'] = array( + $contentWithClaim, + EntityContent::STATUS_NONE + ); + + $contentWithClaimAndLink = $contentWithClaim-copy(); + $contentWithClaimAndLink-getEntity()-getSiteLinkList()-addNewSiteLink( 'enwiki', 'Foo' ); + + $cases['statements and links'] = array( + $contentWithClaimAndLink, + EntityContent::STATUS_NONE + ); return $cases; } -- To view, visit https://gerrit.wikimedia.org/r/153869 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib3d761912e5721e63d14e4565c8a272ab4164f50 Gerrit-PatchSet: 3 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch:
[MediaWiki-commits] [Gerrit] Make ItemContentTest work with DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make ItemContentTest work with DataModel 1.0 .. Make ItemContentTest work with DataModel 1.0 Change-Id: I5dcd38e4e976d022c1e8e208a9201a1291c98df6 --- M repo/includes/content/ItemContent.php 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/repo/includes/content/ItemContent.php b/repo/includes/content/ItemContent.php index 38bc3b5..48960f6 100644 --- a/repo/includes/content/ItemContent.php +++ b/repo/includes/content/ItemContent.php @@ -275,7 +275,7 @@ */ public function getEntityStatus() { $status = parent::getEntityStatus(); - $hasSiteLinks = $this-getItem()-hasSiteLinks(); + $hasSiteLinks = !$this-getItem()-getSiteLinkList()-isEmpty(); if ( $status === self::STATUS_EMPTY $hasSiteLinks ) { $status = self::STATUS_LINKSTUB; -- To view, visit https://gerrit.wikimedia.org/r/153880 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5dcd38e4e976d022c1e8e208a9201a1291c98df6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Bene benestar.wikime...@gmail.com Gerrit-Reviewer: Addshore addshorew...@gmail.com Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Daniel Kinzler daniel.kinz...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Make monolingual-text datatype non-experimental - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Make monolingual-text datatype non-experimental .. Make monolingual-text datatype non-experimental Change-Id: Ifc2921f1c247de8f32d0b9dc4482484ea4e14f45 --- M lib/config/WikibaseLib.default.php M lib/includes/WikibaseDataTypeBuilders.php M lib/tests/phpunit/WikibaseDataTypeBuildersTest.php 3 files changed, 6 insertions(+), 5 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/lib/config/WikibaseLib.default.php b/lib/config/WikibaseLib.default.php index 6f82f10..292605f 100644 --- a/lib/config/WikibaseLib.default.php +++ b/lib/config/WikibaseLib.default.php @@ -98,6 +98,7 @@ 'commonsMedia', 'globe-coordinate', 'quantity', + 'monolingualtext', 'string', 'time', 'url', @@ -113,7 +114,6 @@ if ( defined( 'WB_EXPERIMENTAL_FEATURES' ) WB_EXPERIMENTAL_FEATURES ) { // experimental data types $defaults['dataTypes'] = array_merge( $defaults['dataTypes'], array( - 'monolingualtext', //'multilingual-text', ) ); } diff --git a/lib/includes/WikibaseDataTypeBuilders.php b/lib/includes/WikibaseDataTypeBuilders.php index 92300b8..3e84ccc 100644 --- a/lib/includes/WikibaseDataTypeBuilders.php +++ b/lib/includes/WikibaseDataTypeBuilders.php @@ -92,10 +92,10 @@ 'time' = array( $this, 'buildTimeType' ), 'url' = array( $this, 'buildUrlType' ), 'wikibase-item'= array( $this, 'buildItemType' ), + 'monolingualtext' = array( $this, 'buildMonolingualTextType' ), ); $experimental = array( - 'monolingualtext' = array( $this, 'buildMonolingualTextType' ), // 'multilingualtext' = array( $this, 'buildMultilingualTextType' ), ); diff --git a/lib/tests/phpunit/WikibaseDataTypeBuildersTest.php b/lib/tests/phpunit/WikibaseDataTypeBuildersTest.php index fbb0411..7ce7a57 100644 --- a/lib/tests/phpunit/WikibaseDataTypeBuildersTest.php +++ b/lib/tests/phpunit/WikibaseDataTypeBuildersTest.php @@ -164,13 +164,14 @@ array( 'quantity', QuantityValue::newFromNumber( 5 ), true, 'Simple integer' ), array( 'quantity', QuantityValue::newFromNumber( 5, 'm' ), false, 'We don\'t support units yet' ), array( 'quantity', QuantityValue::newFromDecimal( '-11.234', '1', '-10', '-12' ), true, 'decimal strings' ), + + //monolingual text + array( 'monolingualtext', new MonoLingualTextValue( 'en', 'text' ), true, 'Simple value' ), + array( 'monolingualtext', new MonoLingualTextValue( 'grrr', 'text' ), false, 'Not a valid language' ), ); if ( defined( 'WB_EXPERIMENTAL_FEATURES' ) WB_EXPERIMENTAL_FEATURES ) { $cases = array_merge( $cases, array( - - array( 'monolingualtext', new MonoLingualTextValue( 'en', 'text' ), true, 'Simple value' ), - array( 'monolingualtext', new MonoLingualTextValue( 'grrr', 'text' ), false, 'Not a valid language' ), // ) ); -- To view, visit https://gerrit.wikimedia.org/r/153780 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifc2921f1c247de8f32d0b9dc4482484ea4e14f45 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Tobias Gritschacher tobias.gritschac...@wikimedia.de Gerrit-Reviewer: Aude aude.w...@gmail.com Gerrit-Reviewer: Henning Snater henning.sna...@wikimedia.de Gerrit-Reviewer: Hoo man h...@online.de Gerrit-Reviewer: Jeroen De Dauw jeroended...@gmail.com Gerrit-Reviewer: Thiemo Mättig (WMDE) thiemo.maet...@wikimedia.de Gerrit-Reviewer: Tobias Gritschacher tobias.gritschac...@wikimedia.de Gerrit-Reviewer: WikidataJenkins wikidata-servi...@wikimedia.de Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Update restriction - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153605 Change subject: Update restriction .. Update restriction Change-Id: I8a6cce56cef74712d6d558f02f52a2fab8b3a05c --- M lib/tests/phpunit/NoBadDependencyUsageTest.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/05/153605/1 diff --git a/lib/tests/phpunit/NoBadDependencyUsageTest.php b/lib/tests/phpunit/NoBadDependencyUsageTest.php index 9ac7028..b74eda6 100644 --- a/lib/tests/phpunit/NoBadDependencyUsageTest.php +++ b/lib/tests/phpunit/NoBadDependencyUsageTest.php @@ -23,7 +23,7 @@ public function testNoClientUsageInLib() { // Increasing this allowance is forbidden $this-assertStringNotInLib( 'WikibaseClient' . '::', 3 ); - $this-assertStringNotInLib( 'Wikibase\\Client\\', 2 ); + $this-assertStringNotInLib( 'Wikibase\\Client\\', 3 ); } public function testNoSettingsUsageOutsideLib() { -- To view, visit https://gerrit.wikimedia.org/r/153605 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8a6cce56cef74712d6d558f02f52a2fab8b3a05c Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix phpdocs - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153607 Change subject: Fix phpdocs .. Fix phpdocs Change-Id: I2dbad351ccf9ca41628cd310bdd97575a53136fa --- M lib/includes/Localizer/DispatchingExceptionLocalizer.php M lib/includes/Localizer/MessageExceptionLocalizer.php M lib/includes/Localizer/ParseExceptionLocalizer.php 3 files changed, 4 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/07/153607/1 diff --git a/lib/includes/Localizer/DispatchingExceptionLocalizer.php b/lib/includes/Localizer/DispatchingExceptionLocalizer.php index 9373b3c..6d7fb8b 100644 --- a/lib/includes/Localizer/DispatchingExceptionLocalizer.php +++ b/lib/includes/Localizer/DispatchingExceptionLocalizer.php @@ -33,6 +33,7 @@ * @param Exception $exception * * @return Message +* @throws InvalidArgumentException */ public function getExceptionMessage( Exception $exception ) { $localizer = $this-getLocalizerForException( $exception ); diff --git a/lib/includes/Localizer/MessageExceptionLocalizer.php b/lib/includes/Localizer/MessageExceptionLocalizer.php index 9710ce4..be98467 100644 --- a/lib/includes/Localizer/MessageExceptionLocalizer.php +++ b/lib/includes/Localizer/MessageExceptionLocalizer.php @@ -20,6 +20,7 @@ * @param Exception $exception * * @return Message +* @throws InvalidArgumentException */ public function getExceptionMessage( Exception $exception ) { if ( !$this-hasExceptionMessage( $exception ) ) { diff --git a/lib/includes/Localizer/ParseExceptionLocalizer.php b/lib/includes/Localizer/ParseExceptionLocalizer.php index 745e3cb..dc2dc99 100644 --- a/lib/includes/Localizer/ParseExceptionLocalizer.php +++ b/lib/includes/Localizer/ParseExceptionLocalizer.php @@ -19,9 +19,10 @@ /** * @see ExceptionLocalizer::getExceptionMessage() * -* @param ParseException $exception +* @param Exception $exception * * @return Message +* @throws InvalidArgumentException */ public function getExceptionMessage( Exception $exception ) { if ( !$this-hasExceptionMessage( $exception ) ) { -- To view, visit https://gerrit.wikimedia.org/r/153607 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2dbad351ccf9ca41628cd310bdd97575a53136fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unused imports from Lib - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153608 Change subject: Remove unused imports from Lib .. Remove unused imports from Lib Change-Id: Ia2ae11c8e1fb6e47a1b5b1a3d30c6cb6fe339392 --- M lib/includes/Reporting/ReportingExceptionHandler.php M lib/includes/formatters/EntityIdHtmlLinkFormatter.php M lib/includes/formatters/EntityIdLabelFormatter.php M lib/includes/serializers/LegacyInternalEntitySerializer.php M lib/includes/serializers/SnakSerializer.php M lib/includes/store/CachingEntityRevisionLookup.php M lib/includes/store/EntityStore.php M lib/includes/store/UnresolvedRedirectException.php M lib/includes/store/sql/SqlEntityInfoBuilderFactory.php M lib/tests/phpunit/EntityRetrievingDataTypeLookupTest.php M lib/tests/phpunit/MockRepositoryTest.php M lib/tests/phpunit/MockSiteStore.php M lib/tests/phpunit/changes/ItemChangeTest.php M lib/tests/phpunit/changes/TestChanges.php M lib/tests/phpunit/entity/EntityFactoryTest.php M lib/tests/phpunit/formatters/EntityIdLabelFormatterTest.php M lib/tests/phpunit/parsers/MonthNameUnlocalizerTest.php M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php M lib/tests/phpunit/serializers/DispatchingEntitySerializerTest.php M lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M lib/tests/phpunit/store/CachingEntityRevisionLookupTest.php M lib/tests/phpunit/store/ItemUsageIndexTest.php M lib/tests/phpunit/store/SiteLinkTableTest.php 23 files changed, 18 insertions(+), 30 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/08/153608/1 diff --git a/lib/includes/Reporting/ReportingExceptionHandler.php b/lib/includes/Reporting/ReportingExceptionHandler.php index d2daebc..2157121 100644 --- a/lib/includes/Reporting/ReportingExceptionHandler.php +++ b/lib/includes/Reporting/ReportingExceptionHandler.php @@ -3,7 +3,6 @@ namespace Wikibase\Lib\Reporting; use Exception; -use Wikibase\Lib\Reporting\MessageReporter; /** * ReportingExceptionHandler reports exceptions to a MessageReporter. diff --git a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php index 8e3090f..2273325 100644 --- a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php +++ b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php @@ -7,8 +7,8 @@ use Title; use ValueFormatters\FormatterOptions; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\EntityTitleLookup; +use Wikibase\Lib\Store\EntityLookup; /** * Formats entity IDs by generating an HTML link to the corresponding page title. diff --git a/lib/includes/formatters/EntityIdLabelFormatter.php b/lib/includes/formatters/EntityIdLabelFormatter.php index 47df8d0..f108ebb 100644 --- a/lib/includes/formatters/EntityIdLabelFormatter.php +++ b/lib/includes/formatters/EntityIdLabelFormatter.php @@ -7,8 +7,8 @@ use ValueFormatters\FormatterOptions; use ValueFormatters\FormattingException; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\LanguageFallbackChain; +use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\UnresolvedRedirectException; diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php index 08d87f8..062bbf3 100644 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ b/lib/includes/serializers/LegacyInternalEntitySerializer.php @@ -3,8 +3,8 @@ namespace Wikibase\Lib\Serializers; use InvalidArgumentException; -use Wikibase\DataModel\Entity\Entity; use Serializers\Serializer as NewStyleSerializer; +use Wikibase\DataModel\Entity\Entity; /** * Serializer for generating the legacy serialization of an Entity. diff --git a/lib/includes/serializers/SnakSerializer.php b/lib/includes/serializers/SnakSerializer.php index cbf315c..5993a1a 100644 --- a/lib/includes/serializers/SnakSerializer.php +++ b/lib/includes/serializers/SnakSerializer.php @@ -4,13 +4,11 @@ use DataValues\DataValueFactory; use InvalidArgumentException; -use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\Lib\PropertyDataTypeLookup; use Wikibase\Lib\PropertyNotFoundException; use Wikibase\PropertyValueSnak; use Wikibase\Snak; -use Wikibase\SnakObject; /** * Serializer for Snak objects. diff --git a/lib/includes/store/CachingEntityRevisionLookup.php b/lib/includes/store/CachingEntityRevisionLookup.php index 84542ee..c6073cd 100644 --- a/lib/includes/store/CachingEntityRevisionLookup.php +++ b/lib/includes/store/CachingEntityRevisionLookup.php @@ -3,7 +3,6 @@ namespace Wikibase\Lib\Store; use BagOStuff; -use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; use Wikibase\EntityRevision; diff
[MediaWiki-commits] [Gerrit] Optimized repo imports - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153611 Change subject: Optimized repo imports .. Optimized repo imports Change-Id: I051a6a18a94bd5a679c9c479b51f32f9c8223e5c --- M repo/includes/ChangeOp/ChangeOpAliases.php M repo/includes/ChangeOp/ChangeOpDescription.php M repo/includes/ChangeOp/ChangeOpLabel.php M repo/includes/ClaimDiffer.php M repo/includes/Interactors/RedirectCreationInteractor.php M repo/includes/ItemView.php M repo/includes/LinkedData/EntityDataRequestHandler.php M repo/includes/LinkedData/EntityDataSerializationService.php M repo/includes/SummaryFormatter.php M repo/includes/UpdateRepoOnMoveJob.php M repo/includes/View/TermBoxView.php M repo/includes/WikibaseRepo.php M repo/includes/specials/SpecialGoToLinkedPage.php M repo/includes/specials/SpecialItemByTitle.php M repo/includes/specials/SpecialItemDisambiguation.php M repo/includes/store/sql/EntityPerPageBuilder.php M repo/includes/store/sql/PropertyInfoTableBuilder.php M repo/includes/store/sql/SqlStore.php M repo/maintenance/importInterlang.php M repo/maintenance/importProperties.php M repo/tests/phpunit/includes/ClaimHtmlGeneratorTest.php M repo/tests/phpunit/includes/EntityDiffVisualizerTest.php M repo/tests/phpunit/includes/EntityViewPlaceholderExpanderTest.php M repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php M repo/tests/phpunit/includes/ItemMoveTest.php M repo/tests/phpunit/includes/ItemSearchTextGeneratorTest.php M repo/tests/phpunit/includes/LinkedData/EntityDataTestProvider.php M repo/tests/phpunit/includes/Localizer/ChangeOpValidationExceptionLocalizerTest.php M repo/tests/phpunit/includes/UpdateRepoOnMoveJobTest.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php M repo/tests/phpunit/includes/actions/EditEntityActionTest.php M repo/tests/phpunit/includes/api/AvailableBadgesTest.php M repo/tests/phpunit/includes/api/BotEditTest.php M repo/tests/phpunit/includes/api/ClaimModificationHelperTest.php M repo/tests/phpunit/includes/api/IntegrationApiTest.php M repo/tests/phpunit/includes/api/WikibaseApiTestCase.php M repo/tests/phpunit/includes/content/EntityContentDiffTest.php M repo/tests/phpunit/includes/content/EntityContentFactoryTest.php M repo/tests/phpunit/includes/content/EntityContentTest.php M repo/tests/phpunit/includes/content/EntityHandlerTest.php M repo/tests/phpunit/includes/content/ItemHandlerTest.php M repo/tests/phpunit/includes/content/PropertyContentTest.php M repo/tests/phpunit/includes/content/PropertyHandlerTest.php M repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php M repo/tests/phpunit/includes/specials/SpecialItemByTitleTest.php M repo/tests/phpunit/includes/specials/SpecialSetSitelinkTest.php M repo/tests/phpunit/includes/store/WikiPageEntityRevisionLookupTest.php M repo/tests/phpunit/includes/store/sql/ItemsPerSiteBuilderTest.php M repo/tests/phpunit/includes/store/sql/SqlIdGeneratorTest.php M repo/tests/phpunit/includes/store/sql/TermSqlIndexTest.php M repo/tests/phpunit/includes/store/sql/WikiPageEntityStoreTest.php 51 files changed, 44 insertions(+), 85 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/11/153611/1 diff --git a/repo/includes/ChangeOp/ChangeOpAliases.php b/repo/includes/ChangeOp/ChangeOpAliases.php index f33d6c7..0e386da 100644 --- a/repo/includes/ChangeOp/ChangeOpAliases.php +++ b/repo/includes/ChangeOp/ChangeOpAliases.php @@ -5,7 +5,6 @@ use InvalidArgumentException; use ValueValidators\Result; use Wikibase\DataModel\Entity\Entity; -use Wikibase\DataModel\Term\AliasGroup; use Wikibase\DataModel\Term\Fingerprint; use Wikibase\Summary; use Wikibase\Validators\TermValidatorFactory; diff --git a/repo/includes/ChangeOp/ChangeOpDescription.php b/repo/includes/ChangeOp/ChangeOpDescription.php index 945d7ee..673014a 100644 --- a/repo/includes/ChangeOp/ChangeOpDescription.php +++ b/repo/includes/ChangeOp/ChangeOpDescription.php @@ -6,8 +6,6 @@ use ValueValidators\Result; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Term\Fingerprint; -use Wikibase\DataModel\Term\Term; -use Wikibase\DataModel\Term\TermList; use Wikibase\Summary; use Wikibase\Validators\TermValidatorFactory; diff --git a/repo/includes/ChangeOp/ChangeOpLabel.php b/repo/includes/ChangeOp/ChangeOpLabel.php index 4db4755..f053425 100644 --- a/repo/includes/ChangeOp/ChangeOpLabel.php +++ b/repo/includes/ChangeOp/ChangeOpLabel.php @@ -6,7 +6,6 @@ use ValueValidators\Result; use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Term\Fingerprint; -use Wikibase\DataModel\Term\Term; use Wikibase\Summary; use Wikibase\Validators\TermValidatorFactory; diff --git a/repo/includes/ClaimDiffer.php b/repo/includes/ClaimDiffer.php index 420aca9..bd01646 100644 --- a/repo/includes/ClaimDiffer.php +++ b/repo/includes/ClaimDiffer.php @@ -2,8 +2,8 @@ namespace Wikibase; -use
[MediaWiki-commits] [Gerrit] Optimized client imports - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153612 Change subject: Optimized client imports .. Optimized client imports Change-Id: I71c2f0b560004065a6768fb4b910dd0b758fdb97 --- M client/WikibaseClient.hooks.php M client/includes/ChangeHandler.php M client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php M client/includes/DataAccess/PropertyParserFunction/Runner.php M client/includes/WikibaseClient.php M client/includes/hooks/InfoActionHookHandler.php M client/includes/hooks/LanguageLinkBadgeDisplay.php M client/includes/hooks/MovePageNotice.php M client/includes/store/sql/DirectSqlStore.php M client/tests/phpunit/MockClientStore.php M client/tests/phpunit/includes/ChangeHandlerTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RendererFactoryTest.php M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php M client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php M client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php M client/tests/phpunit/includes/hooks/LanguageLinkBadgeDisplayTest.php 17 files changed, 23 insertions(+), 50 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/12/153612/1 diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php index 42ed48c..fa7101d 100644 --- a/client/WikibaseClient.hooks.php +++ b/client/WikibaseClient.hooks.php @@ -32,10 +32,8 @@ use Wikibase\Client\Hooks\BeforePageDisplayHandler; use Wikibase\Client\Hooks\InfoActionHookHandler; use Wikibase\Client\Hooks\LanguageLinkBadgeDisplay; -use Wikibase\Client\Hooks\OtherProjectsSidebarGenerator; use Wikibase\Client\Hooks\SpecialWatchlistQueryHandler; use Wikibase\Client\MovePageNotice; -use Wikibase\Client\OtherProjectsSitesProvider; use Wikibase\Client\WikibaseClient; /** diff --git a/client/includes/ChangeHandler.php b/client/includes/ChangeHandler.php index 8dd11ec..9601647 100644 --- a/client/includes/ChangeHandler.php +++ b/client/includes/ChangeHandler.php @@ -8,7 +8,6 @@ use Title; use Wikibase\Client\WikibaseClient; use Wikibase\Lib\Changes\EntityChangeFactory; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\Store\EntityRevisionLookup; /** diff --git a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php index 11a7f8a..76ce090 100644 --- a/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php +++ b/client/includes/DataAccess/PropertyParserFunction/LanguageAwareRenderer.php @@ -5,16 +5,9 @@ use InvalidArgumentException; use Language; use Status; -use Wikibase\Client\WikibaseClient; -use Wikibase\DataModel\Claim\Claims; -use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\DataModel\Entity\EntityIdParsingException; -use Wikibase\DataModel\Entity\PropertyId; use Wikibase\Lib\PropertyLabelNotResolvedException; use Wikibase\Lib\SnakFormatter; -use Wikibase\Lib\Store\EntityLookup; -use Wikibase\PropertyLabelResolver; /** * Renderer of the {{#property}} parser function. diff --git a/client/includes/DataAccess/PropertyParserFunction/Runner.php b/client/includes/DataAccess/PropertyParserFunction/Runner.php index f95b8cb..f62122c 100644 --- a/client/includes/DataAccess/PropertyParserFunction/Runner.php +++ b/client/includes/DataAccess/PropertyParserFunction/Runner.php @@ -4,7 +4,6 @@ use Parser; use Wikibase\Client\WikibaseClient; -use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\SiteLink; use Wikibase\Lib\Store\SiteLinkLookup; diff --git a/client/includes/WikibaseClient.php b/client/includes/WikibaseClient.php index a442b67..cc338c5 100644 --- a/client/includes/WikibaseClient.php +++ b/client/includes/WikibaseClient.php @@ -15,37 +15,37 @@ use SiteStore; use ValueFormatters\FormatterOptions; use Wikibase\Client\Hooks\OtherProjectsSidebarGenerator; -use Wikibase\ClientStore; use Wikibase\Client\Hooks\ParserFunctionRegistrant; +use Wikibase\ClientStore; use Wikibase\DataAccess\PropertyParserFunction\RendererFactory; use Wikibase\DataAccess\PropertyParserFunction\Runner; use Wikibase\DataAccess\PropertyParserFunction\SnaksFinder; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\DispatchingEntityIdParser; use Wikibase\DataModel\Entity\EntityIdParser; -use Wikibase\InternalSerialization\DeserializerFactory; -use Wikibase\Lib\Changes\EntityChangeFactory; -use Wikibase\Lib\Serializers\ForbiddenSerializer; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\DataModel\Entity\Item; -use Wikibase\DirectSqlStore; use Wikibase\DataModel\Entity\Property; +use Wikibase\DirectSqlStore; use Wikibase\EntityFactory;
[MediaWiki-commits] [Gerrit] Fix phpdoc - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153697 Change subject: Fix phpdoc .. Fix phpdoc Change-Id: Ib7d0dcef2819aa80f71e56bcd072420c9c039fe2 --- M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php 1 file changed, 2 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/97/153697/1 diff --git a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php index 991774e..a9c7774 100644 --- a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php +++ b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php @@ -27,6 +27,8 @@ /** * @param SnaksFinder $snaksFinder * @param string $languageCode +* +* @return LanguageAwareRenderer */ private function getRenderer( SnaksFinder $snaksFinder, $languageCode ) { $targetLanguage = Language::factory( $languageCode ); -- To view, visit https://gerrit.wikimedia.org/r/153697 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib7d0dcef2819aa80f71e56bcd072420c9c039fe2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Minor cleanup in SnaksFinder - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153698 Change subject: Minor cleanup in SnaksFinder .. Minor cleanup in SnaksFinder Change-Id: Ibebb95f4e58560abe4b31cba2f8c546b906bc4f7 --- M client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php 1 file changed, 4 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/98/153698/1 diff --git a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php index 28d5dbc..bf28fb5 100644 --- a/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php +++ b/client/includes/DataAccess/PropertyParserFunction/SnaksFinder.php @@ -9,6 +9,7 @@ use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\DataModel\Entity\PropertyId; +use Wikibase\DataModel\Snak\Snak; use Wikibase\Lib\PropertyLabelNotResolvedException; use Wikibase\Lib\Store\EntityLookup; use Wikibase\PropertyLabelResolver; @@ -16,7 +17,7 @@ /** * Find Snaks for claims in an entity, with EntityId, based on property label or property id. * - * @fixme see what code can be shared with Lua handling code. + * TODO: see what code can be shared with Lua handling code. * * @since 0.5 * @@ -42,8 +43,9 @@ /** * @param EntityId $entityId * @param string $propertyLabel +* @param string $languageCode * -* @fixme use SnakList instead of array of Snaks +* TODO: use SnakList instead of array of Snaks * * @return Snak[] */ -- To view, visit https://gerrit.wikimedia.org/r/153698 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibebb95f4e58560abe4b31cba2f8c546b906bc4f7 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Improve phpdoc in ChangeHandlerTest and improve class ref - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153699 Change subject: Improve phpdoc in ChangeHandlerTest and improve class ref .. Improve phpdoc in ChangeHandlerTest and improve class ref Change-Id: I303a4ca6b475a88e4d17cde4446d74f6e15d50d2 --- M client/tests/phpunit/includes/ChangeHandlerTest.php 1 file changed, 5 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/99/153699/1 diff --git a/client/tests/phpunit/includes/ChangeHandlerTest.php b/client/tests/phpunit/includes/ChangeHandlerTest.php index 1698a9e..8b601fa 100644 --- a/client/tests/phpunit/includes/ChangeHandlerTest.php +++ b/client/tests/phpunit/includes/ChangeHandlerTest.php @@ -2,6 +2,7 @@ namespace Wikibase\Test; +use Diff\Differ\MapDiffer; use Site; use Title; use Wikibase\Change; @@ -127,10 +128,10 @@ } /** -* @param array$values -* @param \Wikibase\EntityDiff $diff +* @param array $values +* @param EntityDiff|null $diff * -* @return \Wikibase\EntityChange +* @return EntityChange */ public static function makeChange( array $values, EntityDiff $diff = null ) { if ( !isset( $values['info'] ) ) { @@ -171,7 +172,7 @@ } public static function makeDiff( $type, $before, $after ) { - $differ = new \Diff\MapDiffer( true ); + $differ = new MapDiffer( true ); $diffOps = $differ-doDiff( $before, $after ); $diff = EntityDiff::newForType( $type, $diffOps ); -- To view, visit https://gerrit.wikimedia.org/r/153699 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I303a4ca6b475a88e4d17cde4446d74f6e15d50d2 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove dead code - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153700 Change subject: Remove dead code .. Remove dead code Change-Id: I948b69d396c1b63c59738fca3fbbb1d03fe07719 --- M client/includes/UpdateRepo.php 1 file changed, 1 insertion(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/00/153700/1 diff --git a/client/includes/UpdateRepo.php b/client/includes/UpdateRepo.php index 4a5088a..58804bd 100644 --- a/client/includes/UpdateRepo.php +++ b/client/includes/UpdateRepo.php @@ -136,20 +136,8 @@ $job = $this-createJob(); wfProfileIn( __METHOD__ . '#push' ); - $result = $jobQueueGroup-push( $job ); + $jobQueueGroup-push( $job ); wfProfileOut( __METHOD__ . '#push' ); - - // MediaWiki 1.24+ throws exceptions on error instead of returning false, - // but JobQueueGroup::push returns a useless true value. - // - // We do explicit check for false, for backwards compatibility with MediaWiki 1.23 - // and to make robust in case the useless true return value is removed in core. - // - // @todo The check can be removed when we do not support 1.23 anymore. - if ( $result === false ) { - wfProfileOut( __METHOD__ ); - throw new RuntimeException( Failed to push job to job queue ); - } wfProfileOut( __METHOD__ ); } -- To view, visit https://gerrit.wikimedia.org/r/153700 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I948b69d396c1b63c59738fca3fbbb1d03fe07719 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Minor tweak in PopulateInterwiki - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153701 Change subject: Minor tweak in PopulateInterwiki .. Minor tweak in PopulateInterwiki Change-Id: I2f6fc0139b3ffa6ab70420207710ef0e23fbceed --- M client/maintenance/populateInterwiki.php 1 file changed, 1 insertion(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/01/153701/1 diff --git a/client/maintenance/populateInterwiki.php b/client/maintenance/populateInterwiki.php index 2ac2e5a..1f618cf 100644 --- a/client/maintenance/populateInterwiki.php +++ b/client/maintenance/populateInterwiki.php @@ -65,9 +65,8 @@ ); // todo: is valid - if ( !empty ( $this-source ) ) { + if ( !empty( $this-source ) ) { try { - // make sure this has the '?' $baseUrl = rtrim( $this-source, '?' ) . '?'; } catch( Exception $e ) { $this-error( Error: Invalid api source ); -- To view, visit https://gerrit.wikimedia.org/r/153701 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2f6fc0139b3ffa6ab70420207710ef0e23fbceed Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unused imports from Lib - change (mediawiki...Wikibase)
Jeroen De Dauw has submitted this change and it was merged. Change subject: Remove unused imports from Lib .. Remove unused imports from Lib Change-Id: Ia2ae11c8e1fb6e47a1b5b1a3d30c6cb6fe339392 --- M lib/includes/Reporting/ReportingExceptionHandler.php M lib/includes/formatters/EntityIdHtmlLinkFormatter.php M lib/includes/formatters/EntityIdLabelFormatter.php M lib/includes/serializers/LegacyInternalEntitySerializer.php M lib/includes/serializers/SnakSerializer.php M lib/includes/store/CachingEntityRevisionLookup.php M lib/includes/store/EntityStore.php M lib/includes/store/UnresolvedRedirectException.php M lib/includes/store/sql/SqlEntityInfoBuilderFactory.php M lib/tests/phpunit/EntityRetrievingDataTypeLookupTest.php M lib/tests/phpunit/MockRepositoryTest.php M lib/tests/phpunit/changes/ItemChangeTest.php M lib/tests/phpunit/changes/TestChanges.php M lib/tests/phpunit/entity/EntityFactoryTest.php M lib/tests/phpunit/formatters/EntityIdLabelFormatterTest.php M lib/tests/phpunit/parsers/MonthNameUnlocalizerTest.php M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php M lib/tests/phpunit/serializers/DispatchingEntitySerializerTest.php M lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M lib/tests/phpunit/store/CachingEntityRevisionLookupTest.php M lib/tests/phpunit/store/ItemUsageIndexTest.php M lib/tests/phpunit/store/SiteLinkTableTest.php 22 files changed, 18 insertions(+), 29 deletions(-) Approvals: WikidataJenkins: Verified Jeroen De Dauw: Looks good to me, approved diff --git a/lib/includes/Reporting/ReportingExceptionHandler.php b/lib/includes/Reporting/ReportingExceptionHandler.php index d2daebc..2157121 100644 --- a/lib/includes/Reporting/ReportingExceptionHandler.php +++ b/lib/includes/Reporting/ReportingExceptionHandler.php @@ -3,7 +3,6 @@ namespace Wikibase\Lib\Reporting; use Exception; -use Wikibase\Lib\Reporting\MessageReporter; /** * ReportingExceptionHandler reports exceptions to a MessageReporter. diff --git a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php index 8e3090f..2273325 100644 --- a/lib/includes/formatters/EntityIdHtmlLinkFormatter.php +++ b/lib/includes/formatters/EntityIdHtmlLinkFormatter.php @@ -7,8 +7,8 @@ use Title; use ValueFormatters\FormatterOptions; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\EntityTitleLookup; +use Wikibase\Lib\Store\EntityLookup; /** * Formats entity IDs by generating an HTML link to the corresponding page title. diff --git a/lib/includes/formatters/EntityIdLabelFormatter.php b/lib/includes/formatters/EntityIdLabelFormatter.php index 47df8d0..f108ebb 100644 --- a/lib/includes/formatters/EntityIdLabelFormatter.php +++ b/lib/includes/formatters/EntityIdLabelFormatter.php @@ -7,8 +7,8 @@ use ValueFormatters\FormatterOptions; use ValueFormatters\FormattingException; use Wikibase\DataModel\Entity\EntityId; -use Wikibase\Lib\Store\EntityLookup; use Wikibase\LanguageFallbackChain; +use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\UnresolvedRedirectException; diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php index 08d87f8..062bbf3 100644 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ b/lib/includes/serializers/LegacyInternalEntitySerializer.php @@ -3,8 +3,8 @@ namespace Wikibase\Lib\Serializers; use InvalidArgumentException; -use Wikibase\DataModel\Entity\Entity; use Serializers\Serializer as NewStyleSerializer; +use Wikibase\DataModel\Entity\Entity; /** * Serializer for generating the legacy serialization of an Entity. diff --git a/lib/includes/serializers/SnakSerializer.php b/lib/includes/serializers/SnakSerializer.php index cbf315c..5993a1a 100644 --- a/lib/includes/serializers/SnakSerializer.php +++ b/lib/includes/serializers/SnakSerializer.php @@ -4,13 +4,11 @@ use DataValues\DataValueFactory; use InvalidArgumentException; -use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\Lib\PropertyDataTypeLookup; use Wikibase\Lib\PropertyNotFoundException; use Wikibase\PropertyValueSnak; use Wikibase\Snak; -use Wikibase\SnakObject; /** * Serializer for Snak objects. diff --git a/lib/includes/store/CachingEntityRevisionLookup.php b/lib/includes/store/CachingEntityRevisionLookup.php index 84542ee..c6073cd 100644 --- a/lib/includes/store/CachingEntityRevisionLookup.php +++ b/lib/includes/store/CachingEntityRevisionLookup.php @@ -3,7 +3,6 @@ namespace Wikibase\Lib\Store; use BagOStuff; -use Wikibase\DataModel\Entity\Entity; use Wikibase\DataModel\Entity\EntityId; use Wikibase\EntityRevision; diff --git a/lib/includes/store/EntityStore.php b/lib/includes/store/EntityStore.php index
[MediaWiki-commits] [Gerrit] Remove dead line - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153703 Change subject: Remove dead line .. Remove dead line Change-Id: I684146f1b631242eb14b5e65c94dbd5a6b98486d --- M lib/includes/store/GenericEntityInfoBuilder.php 1 file changed, 0 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/03/153703/1 diff --git a/lib/includes/store/GenericEntityInfoBuilder.php b/lib/includes/store/GenericEntityInfoBuilder.php index 76ad792..76d67cb 100644 --- a/lib/includes/store/GenericEntityInfoBuilder.php +++ b/lib/includes/store/GenericEntityInfoBuilder.php @@ -133,7 +133,6 @@ */ private function applyRedirect( $idString, EntityId $targetId) { $redirectedId = $this-parseId( $idString ); - $type = $redirectedId-getEntityType(); $targetKey = $targetId-getSerialization(); -- To view, visit https://gerrit.wikimedia.org/r/153703 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I684146f1b631242eb14b5e65c94dbd5a6b98486d Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Fix class ref - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153710 Change subject: Fix class ref .. Fix class ref Change-Id: Ic12553496847b27a96bf32531261f046f3dd57d0 --- M repo/includes/LinkedData/EntityDataRequestHandler.php 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/10/153710/1 diff --git a/repo/includes/LinkedData/EntityDataRequestHandler.php b/repo/includes/LinkedData/EntityDataRequestHandler.php index a89b6f8..90658dd 100644 --- a/repo/includes/LinkedData/EntityDataRequestHandler.php +++ b/repo/includes/LinkedData/EntityDataRequestHandler.php @@ -7,11 +7,11 @@ use SquidUpdate; use WebRequest; use WebResponse; -use Wikibase\BadRevisionException; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\EntityRevision; +use Wikibase\Lib\Store\BadRevisionException; use Wikibase\Lib\Store\EntityRedirectResolvingDecorator; use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\EntityTitleLookup; -- To view, visit https://gerrit.wikimedia.org/r/153710 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic12553496847b27a96bf32531261f046f3dd57d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove unused vars - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153711 Change subject: Remove unused vars .. Remove unused vars Change-Id: Ie78b7d79933e3159765a4d69a4f1ed643085e866 --- M repo/includes/api/ApiErrorReporter.php M repo/includes/store/sql/EntityPerPageBuilder.php M repo/includes/store/sql/ItemsPerSiteBuilder.php M repo/includes/store/sql/PropertyInfoTableBuilder.php M repo/includes/store/sql/TermSearchKeyBuilder.php 5 files changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/11/153711/1 diff --git a/repo/includes/api/ApiErrorReporter.php b/repo/includes/api/ApiErrorReporter.php index 6d2e0a1..bbace38 100644 --- a/repo/includes/api/ApiErrorReporter.php +++ b/repo/includes/api/ApiErrorReporter.php @@ -134,7 +134,7 @@ $this-addStatusToResult( $status, $extradata ); //XXX: when to prefer $statusCode over $errorCode? - list( $statusCode, $description ) = $this-apiModule-getErrorFromStatus( $status ); + list( , $description ) = $this-apiModule-getErrorFromStatus( $status ); $this-throwUsageException( $description, $errorCode, $httpRespCode, $extradata ); diff --git a/repo/includes/store/sql/EntityPerPageBuilder.php b/repo/includes/store/sql/EntityPerPageBuilder.php index f3e7e52..e576a4e 100644 --- a/repo/includes/store/sql/EntityPerPageBuilder.php +++ b/repo/includes/store/sql/EntityPerPageBuilder.php @@ -247,7 +247,7 @@ $lb = wfGetLB(); //TODO: allow foreign DB, get from $this-table while ( true ) { - list( $host, $maxLag ) = $lb-getMaxLag(); + list( , $maxLag ) = $lb-getMaxLag(); if ( $maxLag 2 ) { break; } diff --git a/repo/includes/store/sql/ItemsPerSiteBuilder.php b/repo/includes/store/sql/ItemsPerSiteBuilder.php index 62d1bc4..faab184 100644 --- a/repo/includes/store/sql/ItemsPerSiteBuilder.php +++ b/repo/includes/store/sql/ItemsPerSiteBuilder.php @@ -119,7 +119,7 @@ $lb = wfGetLB(); //TODO: allow foreign DB, get from $this-table while ( true ) { - list( $host, $maxLag ) = $lb-getMaxLag(); + list( , $maxLag ) = $lb-getMaxLag(); if ( $maxLag 2 ) { break; } diff --git a/repo/includes/store/sql/PropertyInfoTableBuilder.php b/repo/includes/store/sql/PropertyInfoTableBuilder.php index 00abf99..0f8a47d 100644 --- a/repo/includes/store/sql/PropertyInfoTableBuilder.php +++ b/repo/includes/store/sql/PropertyInfoTableBuilder.php @@ -234,7 +234,7 @@ $lb = wfGetLB(); //TODO: allow foreign DB, get from $this-propertyInfoTable while ( true ) { - list( $host, $maxLag ) = $lb-getMaxLag(); + list( , $maxLag ) = $lb-getMaxLag(); if ( $maxLag 2 ) { break; } diff --git a/repo/includes/store/sql/TermSearchKeyBuilder.php b/repo/includes/store/sql/TermSearchKeyBuilder.php index 8b98168..7ba2899 100644 --- a/repo/includes/store/sql/TermSearchKeyBuilder.php +++ b/repo/includes/store/sql/TermSearchKeyBuilder.php @@ -198,7 +198,7 @@ $lb = wfGetLB(); //TODO: allow foreign DB, get from $this-table while ( true ) { - list( $host, $maxLag ) = $lb-getMaxLag(); + list( , $maxLag ) = $lb-getMaxLag(); if ( $maxLag 2 ) { break; } -- To view, visit https://gerrit.wikimedia.org/r/153711 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie78b7d79933e3159765a4d69a4f1ed643085e866 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Remove some presumably dead code - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153712 Change subject: Remove some presumably dead code .. Remove some presumably dead code Change-Id: I43b27ba14979a7c878605b89d896ed3ae5fe0389 --- M repo/includes/EditEntity.php 1 file changed, 1 insertion(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/12/153712/1 diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php index 9486dd9..04f22f9 100644 --- a/repo/includes/EditEntity.php +++ b/repo/includes/EditEntity.php @@ -791,12 +791,7 @@ } } - /** -* @var Entity $entity -*/ - $entity = $this-getNewEntity(); - $baseRev = $this-getBaseRevision(); - $base = $baseRev === null ? null : $baseRev-getEntity(); + $this-getBaseRevision(); return $this-status; } -- To view, visit https://gerrit.wikimedia.org/r/153712 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I43b27ba14979a7c878605b89d896ed3ae5fe0389 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Jeroen De Dauw jeroended...@gmail.com ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] [DNM] Testing against DataModel 1.0 - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153713 Change subject: [DNM] Testing against DataModel 1.0 .. [DNM] Testing against DataModel 1.0 Change-Id: I1113af5ef90fb54c4e638bb14a1fc9e4c2a6cb68 --- M composer.json M lib/includes/serializers/LegacyInternalClaimSerializer.php M lib/includes/serializers/LegacyInternalEntitySerializer.php D lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M repo/config/Wikibase.default.php D repo/tests/phpunit/includes/EditEntityTest.php M repo/tests/phpunit/includes/WikibaseRepoTest.php 7 files changed, 9 insertions(+), 843 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/13/153713/1 diff --git a/composer.json b/composer.json index bdcdcbd..ca670a6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~0.8.2, + wikibase/data-model: ~1.0@dev, wikibase/data-model-javascript: ~0.3.0, wikibase/data-model-serialization: ~1.0.1, wikibase/internal-serialization: ~1.1, diff --git a/lib/includes/serializers/LegacyInternalClaimSerializer.php b/lib/includes/serializers/LegacyInternalClaimSerializer.php index d3fe17b..9bdcdf7 100644 --- a/lib/includes/serializers/LegacyInternalClaimSerializer.php +++ b/lib/includes/serializers/LegacyInternalClaimSerializer.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Wikibase\DataModel\Claim\Claim; +use Wikibase\Repo\WikibaseRepo; class LegacyInternalClaimSerializer implements \Serializers\Serializer { @@ -20,7 +21,7 @@ throw new InvalidArgumentException( '$claim must be an Claim' ); } - return $claim-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalClaimSerializer()-serialize( $claim ); } } diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php index 062bbf3..4e56b2f 100644 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ b/lib/includes/serializers/LegacyInternalEntitySerializer.php @@ -4,7 +4,11 @@ use InvalidArgumentException; use Serializers\Serializer as NewStyleSerializer; + HEAD use Wikibase\DataModel\Entity\Entity; +=== +use Wikibase\Repo\WikibaseRepo; + DNM /** * Serializer for generating the legacy serialization of an Entity. @@ -31,7 +35,7 @@ throw new InvalidArgumentException( '$entity must be an Entity' ); } - return $entity-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalEntitySerializer()-serialize( $entity ); } /** diff --git a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php b/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php deleted file mode 100644 index c2eb039..000 --- a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php +++ /dev/null @@ -1,63 +0,0 @@ -?php - -namespace Wikibase\Test; - -use DataValues\Serializers\DataValueSerializer; -use RuntimeException; -use Wikibase\DataModel\Entity\Item; -use Wikibase\DataModel\Entity\ItemId; -use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Serializers\LegacyInternalEntitySerializer; - -/** - * @covers Wikibase\Lib\Serializers\LegacyInternalEntitySerializer - * - * @group WikibaseLib - * @group Wikibase - * @group WikibaseSerialization - * - * @licence GNU GPL v2+ - * @author Daniel Kinzler - */ -class LegacyInternalEntitySerializerTest extends \PHPUnit_Framework_TestCase { - - public function legacyFormatBlobProvider() { - $entity = Item::newEmpty(); - $entity-setId( new ItemId( 'Q12' ) ); - $entity-setLabel( 'en', 'Test' ); - - // make legacy blob - $legacySerializer = new LegacyInternalEntitySerializer(); - $oldBlob = json_encode( $legacySerializer-serialize( $entity ) ); - - // fake ancient legacy blob: - // replace entity:[item,7] with entity:q7 - $id = $entity-getId()-getSerialization(); - $veryOldBlob = preg_replace( '/entity:\[\w+,\d+\]/', 'entity:' . strtolower( $id ) . '', $oldBlob ); - - // sanity - if ( $oldBlob == $veryOldBlob ) { - throw new RuntimeException( 'Failed to fake very old serialization format based on oldish serialization format.' ); - } - - // make new style blob - $newSerializerFactory = new SerializerFactory( new DataValueSerializer() ); - $newSerializer = $newSerializerFactory-newEntitySerializer();
[MediaWiki-commits] [Gerrit] [DNM] DM 1.0 compat - change (mediawiki...Wikibase)
Jeroen De Dauw has uploaded a new change for review. https://gerrit.wikimedia.org/r/153714 Change subject: [DNM] DM 1.0 compat .. [DNM] DM 1.0 compat Change-Id: I1ec5ac5c8f7b4a6793edd058882685ad0818d26c --- M composer.json M lib/includes/serializers/LegacyInternalClaimSerializer.php D lib/includes/serializers/LegacyInternalEntitySerializer.php D lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php M repo/config/Wikibase.default.php M repo/tests/phpunit/includes/WikibaseRepoTest.php 6 files changed, 4 insertions(+), 172 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/14/153714/1 diff --git a/composer.json b/composer.json index bdcdcbd..ca670a6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ data-values/javascript: ~0.5.1, data-values/value-view: ~0.6.5, - wikibase/data-model: ~0.8.2, + wikibase/data-model: ~1.0@dev, wikibase/data-model-javascript: ~0.3.0, wikibase/data-model-serialization: ~1.0.1, wikibase/internal-serialization: ~1.1, diff --git a/lib/includes/serializers/LegacyInternalClaimSerializer.php b/lib/includes/serializers/LegacyInternalClaimSerializer.php index d3fe17b..9bdcdf7 100644 --- a/lib/includes/serializers/LegacyInternalClaimSerializer.php +++ b/lib/includes/serializers/LegacyInternalClaimSerializer.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Wikibase\DataModel\Claim\Claim; +use Wikibase\Repo\WikibaseRepo; class LegacyInternalClaimSerializer implements \Serializers\Serializer { @@ -20,7 +21,7 @@ throw new InvalidArgumentException( '$claim must be an Claim' ); } - return $claim-toArray(); + return WikibaseRepo::getDefaultInstance()-getInternalClaimSerializer()-serialize( $claim ); } } diff --git a/lib/includes/serializers/LegacyInternalEntitySerializer.php b/lib/includes/serializers/LegacyInternalEntitySerializer.php deleted file mode 100644 index 062bbf3..000 --- a/lib/includes/serializers/LegacyInternalEntitySerializer.php +++ /dev/null @@ -1,61 +0,0 @@ -?php - -namespace Wikibase\Lib\Serializers; - -use InvalidArgumentException; -use Serializers\Serializer as NewStyleSerializer; -use Wikibase\DataModel\Entity\Entity; - -/** - * Serializer for generating the legacy serialization of an Entity. - * - * @since 0.5 - * @licence GNU GPL v2+ - * @author Daniel Kinzler - */ -class LegacyInternalEntitySerializer implements NewStyleSerializer { - - /** -* Returns an array structure representing the given entity, -* by calling $entity-toArray(). -* -* @see Serializer::getSerialized() -* -* @param Entity $entity -* -* @throws InvalidArgumentException -* @return array -*/ - public function serialize( $entity ) { - if ( !( $entity ) ) { - throw new InvalidArgumentException( '$entity must be an Entity' ); - } - - return $entity-toArray(); - } - - /** -* Detects blobs that may be using a legacy serialization format. -* WikibaseRepo uses this for the $legacyExportFormatDetector parameter -* when constructing EntityHandlers. -* -* @see WikibaseRepo::newItemHandler -* @see WikibaseRepo::newPropertyHandler -* @see EntityHandler::__construct -* -* @note: False positives (detecting a legacy format when really no legacy format was used) -* are acceptable, false negatives (failing to detect a legacy format when one was used) -* are not acceptable. -* -* @param string $blob -* @param string $format -* -* @return bool True if $blob seems to be using a legacy serialization format. -*/ - public static function isBlobUsingLegacyFormat( $blob, $format ) { - // The legacy serialization uses something like entity:[item,21] or - // even entity:p21 for the entity ID. - return preg_match( '/entity\s*:/', $blob ) 0; - } - -} diff --git a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php b/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php deleted file mode 100644 index c2eb039..000 --- a/lib/tests/phpunit/serializers/LegacyInternalEntitySerializerTest.php +++ /dev/null @@ -1,63 +0,0 @@ -?php - -namespace Wikibase\Test; - -use DataValues\Serializers\DataValueSerializer; -use RuntimeException; -use Wikibase\DataModel\Entity\Item; -use Wikibase\DataModel\Entity\ItemId; -use Wikibase\InternalSerialization\SerializerFactory; -use Wikibase\Lib\Serializers\LegacyInternalEntitySerializer; - -/** - * @covers