WikidataBuilder has uploaded a new change for review.

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

Change subject: New Wikidata Build - 2015-08-18T15:11:20+0000
......................................................................

New Wikidata Build - 2015-08-18T15:11:20+0000

Change-Id: I554e48f10216deb673596089d6cf66640e63339e
---
M Wikidata.php
M composer.lock
A extensions/Wikibase/lib/includes/store/HashSiteLinkStore.php
M extensions/Wikibase/lib/tests/phpunit/MockRepository.php
A extensions/Wikibase/lib/tests/phpunit/store/HashSiteLinkStoreTest.php
M extensions/Wikibase/repo/includes/api/CreateClaim.php
M extensions/Wikibase/repo/includes/api/EditEntity.php
M extensions/Wikibase/repo/includes/api/ModifyClaim.php
M extensions/Wikibase/repo/includes/api/ModifyEntity.php
M extensions/Wikibase/repo/includes/api/RemoveClaims.php
M extensions/Wikibase/repo/includes/api/RemoveQualifiers.php
M extensions/Wikibase/repo/includes/api/RemoveReferences.php
M extensions/Wikibase/repo/includes/api/SetAliases.php
M extensions/Wikibase/repo/includes/api/SetClaim.php
M extensions/Wikibase/repo/includes/api/SetClaimValue.php
M extensions/Wikibase/repo/includes/api/SetDescription.php
M extensions/Wikibase/repo/includes/api/SetLabel.php
M extensions/Wikibase/repo/includes/api/SetQualifier.php
M extensions/Wikibase/repo/includes/api/SetReference.php
M extensions/Wikibase/repo/includes/api/SetSiteLink.php
M extensions/Wikibase/repo/tests/phpunit/includes/SummaryFormatterTest.php
M vendor/composer/autoload_classmap.php
M vendor/composer/installed.json
23 files changed, 654 insertions(+), 146 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata 
refs/changes/72/232272/1

diff --git a/Wikidata.php b/Wikidata.php
index 1179742..7aede33 100644
--- a/Wikidata.php
+++ b/Wikidata.php
@@ -4,7 +4,7 @@
 }
 
 // Jenkins stuff part1
-if ( PHP_SAPI === 'cli' && strpos( getenv( 'JOB_NAME' ), 
'mwext-Wikidata-testextension' ) !== false ) {
+if ( isset( $wgWikimediaJenkinsCI ) && $wgWikimediaJenkinsCI == true ) {
        // in future, run as non-experimental
        if ( !defined( 'WB_EXPERIMENTAL_FEATURES' ) || 
!WB_EXPERIMENTAL_FEATURES ) {
                define( 'WB_EXPERIMENTAL_FEATURES', true );
@@ -72,7 +72,7 @@
 );
 
 // Jenkins stuff part2
-if ( PHP_SAPI === 'cli' && strpos( getenv( 'JOB_NAME' ), 
'mwext-Wikidata-testextension' ) !== false ) {
+if ( isset( $wgWikimediaJenkinsCI ) && $wgWikimediaJenkinsCI == true ) {
        //Jenkins always loads both so no need to check if they are loaded 
before getting settings
        require_once __DIR__ . '/extensions/Wikibase/repo/ExampleSettings.php';
        require_once __DIR__ . 
'/extensions/Wikibase/client/ExampleSettings.php';
diff --git a/composer.lock b/composer.lock
index 6cbeeb7..be11539 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1379,12 +1379,12 @@
             "source": {
                 "type": "git",
                 "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-                "reference": "b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8"
+                "reference": "9e7a30d02c246b07e9f518a7b93175c61843b806"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8";,
-                "reference": "b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8",
+                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/9e7a30d02c246b07e9f518a7b93175c61843b806";,
+                "reference": "9e7a30d02c246b07e9f518a7b93175c61843b806",
                 "shasum": ""
             },
             "require": {
@@ -1453,7 +1453,7 @@
                 "wikibaserepo",
                 "wikidata"
             ],
-            "time": "2015-08-18 09:27:53"
+            "time": "2015-08-18 12:08:31"
         },
         {
             "name": "wikibase/wikimedia-badges",
diff --git a/extensions/Wikibase/lib/includes/store/HashSiteLinkStore.php 
b/extensions/Wikibase/lib/includes/store/HashSiteLinkStore.php
new file mode 100644
index 0000000..8a58e1e
--- /dev/null
+++ b/extensions/Wikibase/lib/includes/store/HashSiteLinkStore.php
@@ -0,0 +1,190 @@
+<?php
+
+namespace Wikibase\Lib\Store;
+
+use Wikibase\DataModel\Entity\Item;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\SiteLink;
+use Wikibase\DataModel\SiteLinkList;
+use Wikibase\Lib\Store\SiteLinkStore;
+
+/**
+ * @license GPL 2+
+ * @author Katie Filbert <[email protected]>
+ */
+class HashSiteLinkStore implements SiteLinkStore {
+
+       /**
+        * @var SiteLink[] indexed by prefixed ItemId
+        */
+       private $linksByItemId = array();
+
+       /**
+        * @var ItemId[] indexed by SiteLink link text "siteid:title"
+        */
+       private $itemIdsByLink = array();
+
+       /**
+        * @see SiteLinkStore::getItemIdForLink
+        *
+        * @param string $globalSiteId
+        * @param string $pageTitle
+        *
+        * @return ItemId|null
+        */
+       public function getItemIdForLink( $globalSiteId, $pageTitle ) {
+               $key = "$globalSiteId:$pageTitle";
+
+               if ( isset( $this->itemIdsByLink[$key] ) ) {
+                       return $this->itemIdsByLink[$key];
+               } else {
+                       return null;
+               }
+       }
+
+       /**
+        * @see SiteLinkStore::getLinks
+        *
+        * @param int[] $numericIds Numeric (unprefixed) item ids, Defaults to 
array()
+        * @param string[] $siteIds Defaults to array()
+        * @param string[] $pageNames Defaults to array()
+        *
+        * @return array[]
+        */
+       public function getLinks(
+               array $numericIds = array(),
+               array $siteIds = array(),
+               array $pageNames = array()
+       ) {
+               $links = array();
+
+               foreach ( $this->linksByItemId as $prefixedId => $siteLinks ) {
+                       foreach ( $siteLinks as $siteLink ) {
+                               $itemId = new ItemId( $prefixedId );
+
+                               if ( $this->linkMatches( $itemId, $siteLink, 
$numericIds, $siteIds, $pageNames ) ) {
+                                       $links[] = array(
+                                               $siteLink->getSiteId(),
+                                               $siteLink->getPageName(),
+                                               $itemId->getNumericId(),
+                                       );
+                               }
+                       }
+               }
+
+               return $links;
+       }
+
+       /**
+        * Returns true if the link matches the given conditions.
+        *
+        * @param ItemId $itemId
+        * @param SiteLink $siteLink
+        * @param int[] $numericIds Numeric (unprefixed) item ids
+        * @param string[] $siteIds
+        * @param string[] $pageNames
+        *
+        * @return bool
+        */
+       private function linkMatches(
+               ItemId $itemId,
+               SiteLink $siteLink,
+               array $numericIds,
+               array $siteIds,
+               array $pageNames
+       ) {
+               return ( empty( $numericIds ) || in_array( 
$itemId->getNumericId(), $numericIds ) )
+                       && ( empty( $siteIds ) || in_array( 
$siteLink->getSiteId(), $siteIds ) )
+                       && ( empty( $pageNames ) || in_array( 
$siteLink->getPageName(), $pageNames ) );
+       }
+
+       /**
+        * @see SiteLinkStore::getSiteLinksForItem
+        *
+        * @param ItemId $itemId
+        *
+        * @return SiteLink[]
+        */
+       public function getSiteLinksForItem( ItemId $itemId ) {
+               $prefixedId = $itemId->getSerialization();
+
+               if ( array_key_exists( $prefixedId, $this->linksByItemId ) ) {
+                       return $this->linksByItemId[$prefixedId];
+               }
+
+               return array();
+       }
+
+       /**
+        * @see SiteLinkStore::getItemIdForSiteLink
+        *
+        * @param SiteLink $siteLink
+        *
+        * @return ItemId|null
+        */
+       public function getItemIdForSiteLink( SiteLink $siteLink ) {
+               $siteLinkKey = $this->makeSiteLinkKey( $siteLink );
+
+               if ( array_key_exists( $siteLinkKey, $this->itemIdsByLink ) ) {
+                       return $this->itemIdsByLink[$siteLinkKey];
+               }
+
+               return null;
+       }
+
+       /**
+        * @see SiteLinkStore::saveLinksOfItem
+        *
+        * @param Item $item
+        */
+       public function saveLinksOfItem( Item $item ) {
+               $itemId = $item->getId();
+
+               $this->deleteLinksOfItem( $itemId );
+
+               foreach ( $item->getSiteLinks() as $siteLink ) {
+                       $this->indexByLink( $itemId, $siteLink );
+                       $this->indexByItemId( $itemId, $siteLink );
+               }
+       }
+
+       /**
+        * See SiteLinkStore::deleteLinksOfItem
+        *
+        * @param ItemId $itemId
+        */
+       public function deleteLinksOfItem( ItemId $itemId ) {
+               $prefixedId = $itemId->getSerialization();
+               $siteLinks = $this->getSiteLinksForItem( $itemId );
+
+               foreach ( $siteLinks as $siteLink ) {
+                       $key = $this->makeSiteLinkKey( $siteLink );
+                       unset( $this->itemIdsByLink[$key] );
+               }
+
+               unset( $this->linksByItemId[$prefixedId] );
+       }
+
+       /**
+        * @see SiteLinkStore::clear
+        */
+       public function clear() {
+               $this->linksByItemId = array();
+               $this->itemIdsByLink = array();
+       }
+
+       private function indexByLink( ItemId $itemId, SiteLink $siteLink ) {
+               $key = $this->makeSiteLinkKey( $siteLink );
+               $this->itemIdsByLink[$key] = $itemId;
+       }
+
+       private function indexByItemId( ItemId $itemId, SiteLink $siteLink ) {
+               $prefixedId = $itemId->getSerialization();
+               $this->linksByItemId[$prefixedId][] = $siteLink;
+       }
+
+       private function makeSiteLinkKey( SiteLink $siteLink ) {
+               return $siteLink->getSiteId() . ':' . $siteLink->getPageName();
+       }
+
+}
diff --git a/extensions/Wikibase/lib/tests/phpunit/MockRepository.php 
b/extensions/Wikibase/lib/tests/phpunit/MockRepository.php
index 56a3bfc..20ed3b7 100644
--- a/extensions/Wikibase/lib/tests/phpunit/MockRepository.php
+++ b/extensions/Wikibase/lib/tests/phpunit/MockRepository.php
@@ -26,8 +26,10 @@
 use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\EntityStore;
 use Wikibase\Lib\Store\GenericEntityInfoBuilder;
+use Wikibase\Lib\Store\HashSiteLinkStore;
 use Wikibase\Lib\Store\SiteLinkConflictLookup;
 use Wikibase\Lib\Store\SiteLinkLookup;
+use Wikibase\Lib\Store\SiteLinkStore;
 use Wikibase\Lib\Store\StorageException;
 use Wikibase\Lib\Store\UnresolvedRedirectException;
 use Wikibase\RedirectRevision;
@@ -50,6 +52,11 @@
        SiteLinkLookup,
        SiteLinkConflictLookup
 {
+
+       /**
+        * @var SiteLinkStore
+        */
+       private $siteLinkStore;
 
        /**
         * Entity id serialization => array of EntityRevision
@@ -96,6 +103,10 @@
         * @var int
         */
        private $maxRevisionId = 0;
+
+       public function __construct() {
+               $this->siteLinkStore = new HashSiteLinkStore();
+       }
 
        /**
         * @see EntityLookup::getEntity
@@ -232,16 +243,7 @@
         * @return ItemId|null
         */
        public function getItemIdForLink( $globalSiteId, $pageTitle ) {
-               // We store page titles with spaces instead of underscores
-               $pageTitle = str_replace( '_', ' ', $pageTitle );
-
-               $key = "$globalSiteId:$pageTitle";
-
-               if ( isset( $this->itemByLink[$key] ) ) {
-                       return ItemId::newFromNumber( $this->itemByLink[$key] );
-               } else {
-                       return null;
-               }
+               return $this->siteLinkStore->getItemIdForLink( $globalSiteId, 
$pageTitle );
        }
 
        /**
@@ -252,14 +254,7 @@
         * @return ItemId|null
         */
        public function getItemIdForSiteLink( SiteLink $siteLink ) {
-               $globalSiteId = $siteLink->getSiteId();
-               $pageName = $siteLink->getPageName();
-
-               // @todo: fix test data to use titles with underscores, like 
the site link table does it
-               $title = Title::newFromText( $pageName );
-               $pageTitle = $title->getDBkey();
-
-               return $this->getItemIdForLink( $globalSiteId, $pageTitle );
+               return $this->siteLinkStore->getItemIdForSiteLink( $siteLink );
        }
 
        /**
@@ -268,16 +263,7 @@
         * @param Item $item
         */
        private function registerSiteLinks( Item $item ) {
-               $itemId = $item->getId();
-               $numericId = $itemId->getNumericId();
-
-               $this->unregisterSiteLinks( $itemId );
-
-               /** @var SiteLink $siteLink */
-               foreach ( $item->getSiteLinkList() as $siteLink ) {
-                       $key = $siteLink->getSiteId() . ':' . 
$siteLink->getPageName();
-                       $this->itemByLink[$key] = $numericId;
-               }
+               $this->siteLinkStore->saveLinksOfItem( $item );
        }
 
        /**
@@ -286,13 +272,7 @@
         * @param ItemId $itemId
         */
        private function unregisterSiteLinks( ItemId $itemId ) {
-               $numericId = $itemId->getNumericId();
-
-               foreach ( $this->itemByLink as $key => $n ) {
-                       if ( $n === $numericId ) {
-                               unset( $this->itemByLink[$key] );
-                       }
-               }
+               $this->siteLinkStore->deleteLinksOfItem( $itemId );
        }
 
        /**
@@ -423,58 +403,7 @@
         * @return array[]
         */
        public function getLinks( array $numericIds = array(), array $siteIds = 
array(), array $pageNames = array() ) {
-               $links = array();
-
-               foreach ( array_keys( $this->entities ) as $idString ) {
-                       $itemId = $this->parseId( $idString );
-
-                       if ( !( $itemId instanceof ItemId ) ) {
-                               continue;
-                       }
-
-                       if ( !empty( $numericIds ) && !in_array( 
$itemId->getNumericId(), $numericIds ) ) {
-                               continue;
-                       }
-
-                       /** @var Item $item */
-                       $item = $this->getEntity( $itemId );
-
-                       /** @var SiteLink $siteLink */
-                       foreach ( $item->getSiteLinkList() as $siteLink ) {
-                               if ( $this->linkMatches( $item, $siteLink, 
$numericIds, $siteIds, $pageNames ) ) {
-                                       $links[] = array(
-                                               $siteLink->getSiteId(),
-                                               $siteLink->getPageName(),
-                                               $item->getId()->getNumericId(),
-                                       );
-                               }
-                       }
-               }
-
-               return $links;
-       }
-
-       /**
-        * Returns true if the link matches the given conditions.
-        *
-        * @param Item     $item
-        * @param SiteLink $siteLink
-        * @param int[] $numericIds Numeric (unprefixed) item ids
-        * @param string[] $siteIds
-        * @param string[] $pageNames
-        *
-        * @return bool
-        */
-       private function linkMatches(
-               Item $item,
-               SiteLink $siteLink,
-               array $numericIds,
-               array $siteIds = array(),
-               array $pageNames = array()
-       ) {
-               return ( empty( $numericIds ) || in_array( 
$item->getId()->getNumericId(), $numericIds ) )
-                       && ( empty( $siteIds ) || in_array( 
$siteLink->getSiteId(), $siteIds ) )
-                       && ( empty( $pageNames ) || in_array( 
$siteLink->getPageName(), $pageNames ) );
+               return $this->siteLinkStore->getLinks( $numericIds, $siteIds, 
$pageNames );
        }
 
        /**
@@ -514,14 +443,7 @@
         * @return SiteLink[]
         */
        public function getSiteLinksForItem( ItemId $itemId ) {
-               $entity = $this->getEntity( $itemId );
-
-               if ( $entity instanceof Item ) {
-                       return $entity->getSiteLinks();
-               }
-
-               // FIXME: throw InvalidArgumentException rather then failing 
silently
-               return array();
+               return $this->siteLinkStore->getSiteLinksForItem( $itemId );
        }
 
        /**
diff --git 
a/extensions/Wikibase/lib/tests/phpunit/store/HashSiteLinkStoreTest.php 
b/extensions/Wikibase/lib/tests/phpunit/store/HashSiteLinkStoreTest.php
new file mode 100644
index 0000000..a6f22b1
--- /dev/null
+++ b/extensions/Wikibase/lib/tests/phpunit/store/HashSiteLinkStoreTest.php
@@ -0,0 +1,201 @@
+<?php
+
+namespace Wikibase\Test;
+
+use Wikibase\DataModel\Entity\Item;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\SiteLink;
+use Wikibase\Lib\Store\HashSiteLinkStore;
+
+/**
+ * @covers Wikibase\Lib\Store\HashSiteLinkStore
+ *
+ * @group Wikibase
+ * @group WikibaseLib
+ * @group WikibaseStore
+ *
+ * @licence GNU GPL v2+
+ * @author Daniel Kinzler
+ * @author Katie Filbert < [email protected] >
+ */
+class HashSiteLinkStoreTest extends \PHPUnit_Framework_TestCase {
+
+       public function testGetItemIdForLink() {
+               $itemId = new ItemId( 'Q900' );
+
+               $item = new Item( $itemId );
+               $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Foo' );
+
+               $siteLinkStore = new HashSiteLinkStore();
+               $siteLinkStore->saveLinksOfItem( $item );
+
+               $this->assertEquals( $itemId, $siteLinkStore->getItemIdForLink( 
'enwiki', 'Foo' ) );
+               $this->assertNull( $siteLinkStore->getItemIdForLink( 'xywiki', 
'Foo' ) );
+       }
+
+       public function provideGetLinks() {
+               $cases = array();
+
+               $item1 = new Item( new ItemId( 'Q1' ) );
+               $item1->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Foo' );
+               $item1->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Bar' );
+
+               $item2 = new Item( new ItemId( 'Q2' ) );
+               $item2->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Bar' );
+               $item2->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Xoo' );
+
+               $items = array( $item1, $item2 );
+
+               // #0: all ---------
+               $cases[] = array(
+                       $items,
+                       array(), // items
+                       array(), // sites
+                       array(), // pages
+                       array( // expected
+                               array( 'enwiki', 'Foo', 1 ),
+                               array( 'dewiki', 'Bar', 1 ),
+                               array( 'enwiki', 'Bar', 2 ),
+                               array( 'dewiki', 'Xoo', 2 ),
+                       )
+               );
+
+               // #1: mismatch ---------
+               $cases[] = array(
+                       $items,
+                       array(), // items
+                       array( 'enwiki' ), // sites
+                       array( 'Xoo' ), // pages
+                       array() // expected
+               );
+
+               // #2: by item ---------
+               $cases[] = array(
+                       $items,
+                       array( 1 ), // items
+                       array(), // sites
+                       array(), // pages
+                       array( // expected
+                               array( 'enwiki', 'Foo', 1 ),
+                               array( 'dewiki', 'Bar', 1 ),
+                       )
+               );
+
+               // #3: by site ---------
+               $cases[] = array(
+                       $items,
+                       array(), // items
+                       array( 'enwiki' ), // sites
+                       array(), // pages
+                       array( // expected
+                               array( 'enwiki', 'Foo', 1 ),
+                               array( 'enwiki', 'Bar', 2 ),
+                       )
+               );
+
+               // #4: by page ---------
+               $cases[] = array(
+                       $items,
+                       array(), // items
+                       array(), // sites
+                       array( 'Bar' ), // pages
+                       array( // expected
+                               array( 'dewiki', 'Bar', 1 ),
+                               array( 'enwiki', 'Bar', 2 ),
+                       )
+               );
+
+               // #5: by site and page ---------
+               $cases[] = array(
+                       $items,
+                       array(), // items
+                       array( 'dewiki' ), // sites
+                       array( 'Bar' ), // pages
+                       array( // expected
+                               array( 'dewiki', 'Bar', 1 ),
+                       )
+               );
+
+               return $cases;
+       }
+
+       /**
+        * @dataProvider provideGetLinks
+        */
+       public function testGetLinks( array $items, array $itemIds, array 
$sites, array $pages, array $expectedLinks ) {
+               $siteLinkStore = new HashSiteLinkStore();
+
+               foreach ( $items as $item ) {
+                       $siteLinkStore->saveLinksOfItem( $item );
+               }
+
+               $this->assertEquals( $expectedLinks, $siteLinkStore->getLinks( 
$itemIds, $sites, $pages ) );
+       }
+
+       public function testGetSiteLinksForItem() {
+               $item = new Item( new ItemId( 'Q1' ) );
+
+               $item->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Xoo' );
+               $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Foo' );
+
+               $siteLinkStore = new HashSiteLinkStore();
+               $siteLinkStore->saveLinksOfItem( $item );
+
+               // check link retrieval
+               $this->assertEquals(
+                       array(
+                               new SiteLink( 'dewiki', 'Xoo' ),
+                               new SiteLink( 'enwiki', 'Foo' ),
+                       ),
+                       $siteLinkStore->getSiteLinksForItem( $item->getId() )
+               );
+
+               // check links of unknown id
+               $this->assertEmpty( $siteLinkStore->getSiteLinksForItem( new 
ItemId( 'Q123' ) ) );
+       }
+
+       /**
+        * @covers HashSiteLinkLookup::getItemIdForSiteLink
+        * @covers HashSiteLinkLookup::saveLinksOfItem
+        */
+       public function testGetItemIdForSiteLink() {
+               $itemId = new ItemId( 'Q11' );
+               $siteLink = new SiteLink( 'eswiki', 'Cerveza' );
+
+               $item = new Item( $itemId );
+               $item->getSiteLinkList()->addSiteLink( $siteLink );
+
+               $siteLinkStore = new HashSiteLinkStore();
+               $siteLinkStore->saveLinksOfItem( $item );
+
+               $this->assertEquals( $itemId, 
$siteLinkStore->getItemIdForSiteLink( $siteLink ) );
+       }
+
+       public function testDeleteLinksOfItem() {
+               $itemId = new ItemId( 'Q111' );
+               $siteLink = new SiteLink( 'eswiki', 'Gato' );
+
+               $item = new Item( $itemId );
+               $item->getSiteLinkList()->addSiteLink( $siteLink );
+
+               $siteLinkStore = new HashSiteLinkStore();
+               $siteLinkStore->saveLinksOfItem( $item );
+
+               $this->assertEquals( $itemId, 
$siteLinkStore->getItemIdForSiteLink( $siteLink ) );
+
+               $siteLinkStore->deleteLinksOfItem( $itemId );
+
+               $siteLinks = $siteLinkStore->getSiteLinksForItem( $itemId );
+
+               $this->assertEmpty(
+                       $siteLinkStore->getSiteLinksForItem( $itemId ),
+                       'get by item id'
+               );
+
+               $this->assertNull(
+                       $siteLinkStore->getItemIdForSiteLink( $siteLink ),
+                       'get by site link'
+               );
+       }
+
+}
diff --git a/extensions/Wikibase/repo/includes/api/CreateClaim.php 
b/extensions/Wikibase/repo/includes/api/CreateClaim.php
index 3119beb..47099d6 100644
--- a/extensions/Wikibase/repo/includes/api/CreateClaim.php
+++ b/extensions/Wikibase/repo/includes/api/CreateClaim.php
@@ -122,6 +122,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/EditEntity.php 
b/extensions/Wikibase/repo/includes/api/EditEntity.php
index 68ebfa4..ca3c2a8 100644
--- a/extensions/Wikibase/repo/includes/api/EditEntity.php
+++ b/extensions/Wikibase/repo/includes/api/EditEntity.php
@@ -111,6 +111,24 @@
        }
 
        /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
+        * @see ApiBase::isWriteMode()
+        *
+        * @return bool Always true.
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
         * @param EntityDocument $entity
         *
         * @throws InvalidArgumentException
diff --git a/extensions/Wikibase/repo/includes/api/ModifyClaim.php 
b/extensions/Wikibase/repo/includes/api/ModifyClaim.php
index d5faa32..98341ab 100644
--- a/extensions/Wikibase/repo/includes/api/ModifyClaim.php
+++ b/extensions/Wikibase/repo/includes/api/ModifyClaim.php
@@ -119,22 +119,6 @@
        }
 
        /**
-        * @see ApiBase::isWriteMode
-        */
-       public function isWriteMode() {
-               return true;
-       }
-
-       /**
-        * @see ApiBase::needsToken
-        *
-        * @return string
-        */
-       public function needsToken() {
-               return 'csrf';
-       }
-
-       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/ModifyEntity.php 
b/extensions/Wikibase/repo/includes/api/ModifyEntity.php
index da6663b..7c7db57 100644
--- a/extensions/Wikibase/repo/includes/api/ModifyEntity.php
+++ b/extensions/Wikibase/repo/includes/api/ModifyEntity.php
@@ -516,24 +516,6 @@
        }
 
        /**
-        * @see ApiBase::isWriteMode()
-        *
-        * @return bool Always true.
-        */
-       public function isWriteMode() {
-               return true;
-       }
-
-       /**
-        * @see ApiBase::needsToken
-        *
-        * @return string
-        */
-       public function needsToken() {
-               return 'csrf';
-       }
-
-       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/RemoveClaims.php 
b/extensions/Wikibase/repo/includes/api/RemoveClaims.php
index 4490890..e681d0a 100644
--- a/extensions/Wikibase/repo/includes/api/RemoveClaims.php
+++ b/extensions/Wikibase/repo/includes/api/RemoveClaims.php
@@ -158,6 +158,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/RemoveQualifiers.php 
b/extensions/Wikibase/repo/includes/api/RemoveQualifiers.php
index 0a053d8..d7c18a6 100644
--- a/extensions/Wikibase/repo/includes/api/RemoveQualifiers.php
+++ b/extensions/Wikibase/repo/includes/api/RemoveQualifiers.php
@@ -130,6 +130,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/RemoveReferences.php 
b/extensions/Wikibase/repo/includes/api/RemoveReferences.php
index a445b3f..2c08640 100644
--- a/extensions/Wikibase/repo/includes/api/RemoveReferences.php
+++ b/extensions/Wikibase/repo/includes/api/RemoveReferences.php
@@ -137,6 +137,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/SetAliases.php 
b/extensions/Wikibase/repo/includes/api/SetAliases.php
index 335c544..325bcfe 100644
--- a/extensions/Wikibase/repo/includes/api/SetAliases.php
+++ b/extensions/Wikibase/repo/includes/api/SetAliases.php
@@ -53,6 +53,24 @@
        }
 
        /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
+        * @see ApiBase::isWriteMode()
+        *
+        * @return bool Always true.
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
         * @param EntityDocument $entity
         *
         * @throws InvalidArgumentException
diff --git a/extensions/Wikibase/repo/includes/api/SetClaim.php 
b/extensions/Wikibase/repo/includes/api/SetClaim.php
index 84a02a0..a63ae57 100644
--- a/extensions/Wikibase/repo/includes/api/SetClaim.php
+++ b/extensions/Wikibase/repo/includes/api/SetClaim.php
@@ -176,6 +176,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/SetClaimValue.php 
b/extensions/Wikibase/repo/includes/api/SetClaimValue.php
index 3aa2c04..64921ea 100644
--- a/extensions/Wikibase/repo/includes/api/SetClaimValue.php
+++ b/extensions/Wikibase/repo/includes/api/SetClaimValue.php
@@ -89,6 +89,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/SetDescription.php 
b/extensions/Wikibase/repo/includes/api/SetDescription.php
index 75c7962..69ce5f3 100644
--- a/extensions/Wikibase/repo/includes/api/SetDescription.php
+++ b/extensions/Wikibase/repo/includes/api/SetDescription.php
@@ -82,6 +82,24 @@
        }
 
        /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
+        * @see ApiBase::isWriteMode()
+        *
+        * @return bool Always true.
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
         * @see ApiBase::getExamplesMessages
         */
        protected function getExamplesMessages() {
diff --git a/extensions/Wikibase/repo/includes/api/SetLabel.php 
b/extensions/Wikibase/repo/includes/api/SetLabel.php
index d13a111..725abda 100644
--- a/extensions/Wikibase/repo/includes/api/SetLabel.php
+++ b/extensions/Wikibase/repo/includes/api/SetLabel.php
@@ -82,6 +82,24 @@
        }
 
        /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
+        * @see ApiBase::isWriteMode()
+        *
+        * @return bool Always true.
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
         * @see ApiBase::getExamplesMessages
         */
        protected function getExamplesMessages() {
diff --git a/extensions/Wikibase/repo/includes/api/SetQualifier.php 
b/extensions/Wikibase/repo/includes/api/SetQualifier.php
index a79f1b0..c7825bb 100644
--- a/extensions/Wikibase/repo/includes/api/SetQualifier.php
+++ b/extensions/Wikibase/repo/includes/api/SetQualifier.php
@@ -151,6 +151,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/SetReference.php 
b/extensions/Wikibase/repo/includes/api/SetReference.php
index 206e898..fe80095 100644
--- a/extensions/Wikibase/repo/includes/api/SetReference.php
+++ b/extensions/Wikibase/repo/includes/api/SetReference.php
@@ -166,6 +166,22 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * @see ApiBase::getAllowedParams
         */
        protected function getAllowedParams() {
diff --git a/extensions/Wikibase/repo/includes/api/SetSiteLink.php 
b/extensions/Wikibase/repo/includes/api/SetSiteLink.php
index 5754d2d..0a9daea 100644
--- a/extensions/Wikibase/repo/includes/api/SetSiteLink.php
+++ b/extensions/Wikibase/repo/includes/api/SetSiteLink.php
@@ -53,6 +53,24 @@
        }
 
        /**
+        * @see ApiBase::isWriteMode()
+        *
+        * @return bool Always true.
+        */
+       public function isWriteMode() {
+               return true;
+       }
+
+       /**
+        * @see ApiBase::needsToken
+        *
+        * @return string
+        */
+       public function needsToken() {
+               return 'csrf';
+       }
+
+       /**
         * Checks whether the link should be removed based on params
         *
         * @param array $params
diff --git 
a/extensions/Wikibase/repo/tests/phpunit/includes/SummaryFormatterTest.php 
b/extensions/Wikibase/repo/tests/phpunit/includes/SummaryFormatterTest.php
index aea2f59..ddd0156 100644
--- a/extensions/Wikibase/repo/tests/phpunit/includes/SummaryFormatterTest.php
+++ b/extensions/Wikibase/repo/tests/phpunit/includes/SummaryFormatterTest.php
@@ -79,7 +79,7 @@
        /**
         * @return SummaryFormatter
         */
-       protected function newFormatter() {
+       private function newFormatter() {
                $idFormatter = $this->getMock( 
'Wikibase\DataModel\Services\EntityId\EntityIdFormatter' );
                $idFormatter->expects( $this->any() )->method( 'formatEntityId' 
)
                        ->will( $this->returnCallback( array( $this, 'formatId' 
) ) );
@@ -370,7 +370,7 @@
                                null,
                                '/* summarytest:2| */ A, B'
                        ),
-                       array( // #5
+                       'User summary overrides arguments' => array(
                                'summarytest',
                                'testing',
                                'nl',
@@ -378,8 +378,17 @@
                                array( 'A', 'B' ),
                                'can I haz world domination?',
                                '/* summarytest-testing:2|nl|x|y */ can I haz 
world domination?'
-                               ),
-                       array( // #6
+                       ),
+                       'Trimming' => array(
+                               'summarytest',
+                               'testing',
+                               'de',
+                               array( ' autoArg0 ', ' autoArg1 ' ),
+                               array( ' userArg0 ', ' userArg1 ' ),
+                               ' userSummary ',
+                               '/* summarytest-testing:2|de| autoArg0 | 
autoArg1 */ userSummary'
+                       ),
+                       'User summary only' => array(
                                'summarytest',
                                null,
                                null,
@@ -387,8 +396,8 @@
                                null,
                                'can I haz world domination?',
                                '/* summarytest:0| */ can I haz world 
domination?'
-                               ),
-                       array( // #7
+                       ),
+                       'Array arguments' => array(
                                'summarytest',
                                'testing',
                                'nl',
@@ -397,7 +406,7 @@
                                null,
                                '/* summarytest-testing:2|nl|x|1, 2, 3 */ A, 1, 
2, 3'
                        ),
-                       array( // #8
+                       'Associative arguments' => array(
                                'summarytest',
                                'testing',
                                'nl',
diff --git a/vendor/composer/autoload_classmap.php 
b/vendor/composer/autoload_classmap.php
index 4980a65..30483a0 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -710,6 +710,7 @@
     'Wikibase\\Lib\\Store\\EntityTermLookupBase' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/EntityTermLookupBase.php',
     'Wikibase\\Lib\\Store\\EntityTitleLookup' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/EntityTitleLookup.php',
     'Wikibase\\Lib\\Store\\GenericEntityInfoBuilder' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/GenericEntityInfoBuilder.php',
+    'Wikibase\\Lib\\Store\\HashSiteLinkStore' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/HashSiteLinkStore.php',
     'Wikibase\\Lib\\Store\\LabelConflictFinder' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/LabelConflictFinder.php',
     'Wikibase\\Lib\\Store\\LanguageFallbackLabelDescriptionLookup' => $baseDir 
. 
'/extensions/Wikibase/lib/includes/store/LanguageFallbackLabelDescriptionLookup.php',
     'Wikibase\\Lib\\Store\\RedirectResolvingEntityLookup' => $baseDir . 
'/extensions/Wikibase/lib/includes/store/RedirectResolvingEntityLookup.php',
@@ -1114,6 +1115,7 @@
     'Wikibase\\Test\\FingerprintChangeOpFactoryTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/ChangeOp/FingerprintChangeOpFactoryTest.php',
     'Wikibase\\Test\\FingerprintSearchTextGeneratorTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/FingerprintSearchTextGeneratorTest.php',
     'Wikibase\\Test\\GenericExceptionLocalizerTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/Localizer/GenericExceptionLocalizerTest.php',
+    'Wikibase\\Test\\HashSiteLinkStoreTest' => $baseDir . 
'/extensions/Wikibase/lib/tests/phpunit/store/HashSiteLinkStoreTest.php',
     'Wikibase\\Test\\HttpAcceptNegotiatorTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/LinkedData/HttpAcceptNegotiatorTest.php',
     'Wikibase\\Test\\HttpAcceptParserTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/LinkedData/HttpAcceptParserTest.php',
     'Wikibase\\Test\\IO\\EntityIdReaderTest' => $baseDir . 
'/extensions/Wikibase/repo/tests/phpunit/includes/IO/EntityIdReaderTest.php',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index fd881b2..a3092cd 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1272,12 +1272,12 @@
         "source": {
             "type": "git",
             "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-            "reference": "b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8"
+            "reference": "9e7a30d02c246b07e9f518a7b93175c61843b806"
         },
         "dist": {
             "type": "zip",
-            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8";,
-            "reference": "b9f31e4def71f33ef1c1fc6eb1fd782cd72924b8",
+            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/9e7a30d02c246b07e9f518a7b93175c61843b806";,
+            "reference": "9e7a30d02c246b07e9f518a7b93175c61843b806",
             "shasum": ""
         },
         "require": {
@@ -1308,7 +1308,7 @@
         "require-dev": {
             "squizlabs/php_codesniffer": "~2.1"
         },
-        "time": "2015-08-18 09:27:53",
+        "time": "2015-08-18 12:08:31",
         "type": "mediawiki-extension",
         "installation-source": "dist",
         "autoload": {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I554e48f10216deb673596089d6cf66640e63339e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: master
Gerrit-Owner: WikidataBuilder <[email protected]>

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

Reply via email to