Hoo man has uploaded a new change for review.

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

Change subject: Update Wikibase to 1.25wmf19
......................................................................

Update Wikibase to 1.25wmf19

Change-Id: I6dbae5041797de81ca983ce826941a3a8cc32ecc
---
M composer.json
M composer.lock
M extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
M extensions/Wikibase/client/includes/UpdateRepo/UpdateRepoOnMove.php
A extensions/Wikibase/client/includes/scribunto/EntityAccessor.php
M extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
M extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php
M 
extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
M 
extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
A 
extensions/Wikibase/client/tests/phpunit/includes/scribunto/EntityAccessorTest.php
M 
extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
M 
extensions/Wikibase/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
M extensions/Wikibase/lib/maintenance/populateSitesTable.php
M extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php
M extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php
M vendor/composer/autoload_classmap.php
M vendor/composer/installed.json
17 files changed, 559 insertions(+), 325 deletions(-)


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

diff --git a/composer.json b/composer.json
index dba45bd..331f4f2 100644
--- a/composer.json
+++ b/composer.json
@@ -15,7 +15,7 @@
     "require": {
         "php": ">=5.3.0",
         "propertysuggester/property-suggester": "~2.0.5",
-        "wikibase/wikibase": "dev-wmf/1.25wmf16",
+        "wikibase/wikibase": "dev-wmf/1.25wmf19",
         "wikibase/wikimedia-badges": "dev-master",
         "wikibase/Wikidata.org": "dev-master"
     },
@@ -33,4 +33,4 @@
         "preferred-install": "dist",
         "autoloader-suffix": "wikidata_1_25wmf16"
     }
-}
\ No newline at end of file
+}
diff --git a/composer.lock b/composer.lock
index b9db37b..d5b38fe 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at 
http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file";,
         "This file is @generated automatically"
     ],
-    "hash": "fa6e761fd3ec549e883485531e006137",
+    "hash": "c3fad3d1c5f37f1e0dee56f573c8c131",
     "packages": [
         {
             "name": "composer/installers",
@@ -1230,16 +1230,16 @@
         },
         {
             "name": "wikibase/wikibase",
-            "version": "dev-wmf/1.25wmf16",
+            "version": "dev-wmf/1.25wmf19",
             "source": {
                 "type": "git",
                 "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-                "reference": "c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8"
+                "reference": "1e35501b1b81796eb811f6eed9f945df830df895"
             },
             "dist": {
                 "type": "zip",
-                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8";,
-                "reference": "c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8",
+                "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/1e35501b1b81796eb811f6eed9f945df830df895";,
+                "reference": "1e35501b1b81796eb811f6eed9f945df830df895",
                 "shasum": ""
             },
             "require": {
@@ -1306,7 +1306,7 @@
                 "wikibaserepo",
                 "wikidata"
             ],
-            "time": "2015-02-19 21:07:13"
+            "time": "2015-02-24 18:54:32"
         },
         {
             "name": "wikibase/wikimedia-badges",
diff --git a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php 
b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
index 4480f1a..0f0100e 100644
--- a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
+++ b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepo.php
@@ -134,7 +134,7 @@
        public function injectJob( JobQueueGroup $jobQueueGroup ) {
                wfProfileIn( __METHOD__ );
 
-               $job = $this->createJob();
+               $job = $this->createJob( $jobQueueGroup );
 
                wfProfileIn( __METHOD__ . '#push' );
                $jobQueueGroup->push( $job );
@@ -146,14 +146,21 @@
        /**
         * Returns a new job for updating the repo.
         *
+        * @param JobQueueGroup $jobQueueGroup
+        *
         * @return IJobSpecification
         */
-       public function createJob() {
+       private function createJob( JobQueueGroup $jobQueueGroup ) {
                wfProfileIn( __METHOD__ );
+
+               $params = $this->getJobParameters();
+               if ( $this->delayJobs( $jobQueueGroup ) ) {
+                       $params['jobReleaseTimestamp'] = time() + 
$this->getJobDelay();
+               }
 
                $job = new JobSpecification(
                        $this->getJobName(),
-                       $this->getJobParameters()
+                       $params
                );
 
                wfProfileOut( __METHOD__ );
@@ -162,6 +169,31 @@
        }
 
        /**
+        * @param JobQueueGroup $jobQueueGroup
+        *
+        * @return bool
+        */
+       private function delayJobs( JobQueueGroup $jobQueueGroup ) {
+               return $jobQueueGroup->get( $this->getJobName() 
)->delayedJobsEnabled();
+       }
+
+       /**
+        * Get the time (in seconds) for which the job execution should be 
delayed
+        * (if delayed jobs are enabled). Defaults to the max replag of any 
pooled
+        * DB server + 1 seconds.
+        *
+        * @return int
+        */
+       protected function getJobDelay() {
+               $lagArray = wfGetLB()->getMaxLag();
+               // This should be good enough, especially given that lagged 
servers get
+               // less load by the load balancer, thus it's very unlikely 
we'll end
+               // up on the server with the highest lag.
+               // Note: Always add at least +1 here, otherwise this can be -1
+               return $lagArray[1] + 1;
+       }
+
+       /**
         * Get the parameters for creating a new IJobSpecification
         *
         * @return array
diff --git 
a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepoOnMove.php 
b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepoOnMove.php
index 272ca41..319f249 100644
--- a/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepoOnMove.php
+++ b/extensions/Wikibase/client/includes/UpdateRepo/UpdateRepoOnMove.php
@@ -63,5 +63,4 @@
                        'user' => $this->user->getName()
                );
        }
-
 }
diff --git a/extensions/Wikibase/client/includes/scribunto/EntityAccessor.php 
b/extensions/Wikibase/client/includes/scribunto/EntityAccessor.php
new file mode 100644
index 0000000..976c373
--- /dev/null
+++ b/extensions/Wikibase/client/includes/scribunto/EntityAccessor.php
@@ -0,0 +1,210 @@
+<?php
+
+namespace Wikibase\Client\Scribunto;
+
+use Language;
+use Wikibase\Client\Usage\UsageAccumulator;
+use Wikibase\DataModel\Entity\EntityDocument;
+use Wikibase\DataModel\Entity\EntityIdParser;
+use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
+use Wikibase\LanguageFallbackChainFactory;
+use Wikibase\Lib\Serializers\SerializationOptions;
+use Wikibase\Lib\Serializers\Serializer;
+use Wikibase\Lib\Serializers\SerializerFactory;
+use Wikibase\Lib\Store\EntityLookup;
+
+/**
+ * Functionality needed to expose Entities to Lua.
+ *
+ * @since 0.5
+ *
+ * @license GNU GPL v2+
+ * @author Marius Hoch < h...@online.de >
+ * @author Katie Filbert < aude.w...@gmail.com >
+ * @author Jens Ohlig < jens.oh...@wikimedia.de >
+ */
+class EntityAccessor {
+       /**
+        * @var EntityIdParser
+        */
+       private $entityIdParser;
+
+       /**
+        * @var EntityLookup
+        */
+       private $entityLookup;
+
+       /**
+        * @var UsageAccumulator
+        */
+       private $usageAccumulator;
+
+       /**
+        * @var SerializationOptions|null
+        */
+       private $serializationOptions = null;
+
+       /**
+        * @var LanguageFallbackChainFactory
+        */
+       private $fallbackChainFactory;
+
+       /**
+        * @var string[]
+        */
+       private $languageCodes;
+
+       /**
+        * @var Language
+        */
+       private $language;
+
+       /**
+        * @var PropertyDataTypeLookup
+        */
+       private $dataTypeLookup;
+
+       /**
+        * @param EntityIdParser $entityIdParser
+        * @param EntityLookup $entityLookup
+        * @param UsageAccumulator $usageAccumulator
+        * @param LanguageFallbackChainFactory $fallbackChainFactory
+        * @param string[] $languageCodes
+        * @param Language $language
+        * @param PropertyDataTypeLookup $dataTypeLookup
+        */
+       public function __construct(
+               EntityIdParser $entityIdParser,
+               EntityLookup $entityLookup,
+               UsageAccumulator $usageAccumulator,
+               LanguageFallbackChainFactory $fallbackChainFactory,
+               array $languageCodes,
+               Language $language,
+               PropertyDataTypeLookup $dataTypeLookup
+       ) {
+               $this->entityIdParser = $entityIdParser;
+               $this->entityLookup = $entityLookup;
+               $this->usageAccumulator = $usageAccumulator;
+               $this->fallbackChainFactory = $fallbackChainFactory;
+               $this->languageCodes = $languageCodes;
+               $this->language = $language;
+               $this->dataTypeLookup = $dataTypeLookup;
+       }
+
+       /**
+        * Recursively renumber a serialized array in place, so it is indexed 
at 1, not 0.
+        * Just like Lua wants it.
+        *
+        * @since 0.5
+        *
+        * @param array &$entityArr
+        */
+       public function renumber( array &$entityArr ) {
+               foreach( $entityArr as &$value ) {
+                       if ( !is_array( $value ) ) {
+                               continue;
+                       }
+                       if ( array_key_exists( 0, $value ) ) {
+                               $value = array_combine( range( 1, count( $value 
) ), array_values( $value ) );
+                       }
+                       $this->renumber( $value );
+               }
+       }
+
+       /**
+        * Get entity from prefixed ID (e.g. "Q23") and return it as serialized 
array.
+        *
+        * @since 0.5
+        *
+        * @param string $prefixedEntityId
+        * @param bool $legacyStyle Whether to return a legacy style entity
+        *
+        * @return array
+        */
+       public function getEntity( $prefixedEntityId, $legacyStyle = false ) {
+               $prefixedEntityId = trim( $prefixedEntityId );
+
+               $entityId = $this->entityIdParser->parse( $prefixedEntityId );
+
+               $entityObject = $this->entityLookup->getEntity( $entityId );
+
+               if ( $entityObject === null ) {
+                       return null;
+               }
+
+               $serializer = $this->getEntitySerializer( $entityObject, 
$legacyStyle );
+
+               $entityArr = $serializer->getSerialized( $entityObject );
+
+               if ( $legacyStyle ) {
+                       // Mark the output as Legacy so that we can easily 
distinguish the styles in Lua
+                       $entityArr['schemaVersion'] = 1;
+               } else {
+                       // Renumber the entity as Lua uses 1-based array 
indexing
+                       $this->renumber( $entityArr );
+                       $entityArr['schemaVersion'] = 2;
+               }
+
+               $this->usageAccumulator->addAllUsage( $entityId );
+               return $entityArr;
+       }
+
+       /**
+        * @param EntityDocument $entityObject
+        * @param bool $lowerCaseIds Whether to also use lower case ids
+        *
+        * @return Serializer
+        */
+       private function getEntitySerializer( EntityDocument $entityObject, 
$lowerCaseIds ) {
+               $options = $this->getSerializationOptions( $lowerCaseIds );
+               $serializerFactory = new SerializerFactory( $options, 
$this->dataTypeLookup );
+
+               return $serializerFactory->newSerializerForObject( 
$entityObject, $options );
+       }
+
+       /**
+        * @param bool $lowerCaseIds
+        *
+        * @return SerializationOptions
+        */
+       private function getSerializationOptions( $lowerCaseIds ) {
+               if ( $this->serializationOptions === null ) {
+                       $this->serializationOptions = 
$this->newSerializationOptions();
+               }
+
+               // Using "ID_KEYS_BOTH" here means that all lists of Snaks or 
Claims will be listed
+               // twice, once with a lower case key and once with an upper 
case key.
+               // This is a B/C hack to allow existing lua code to use 
hardcoded IDs
+               // in both lower (legacy) and upper case.
+               if ( $lowerCaseIds ) {
+                       $this->serializationOptions->setIdKeyMode( 
SerializationOptions::ID_KEYS_BOTH );
+               } else {
+                       $this->serializationOptions->setIdKeyMode( 
SerializationOptions::ID_KEYS_UPPER );
+               }
+
+               return $this->serializationOptions;
+       }
+
+       /**
+        * @return SerializationOptions
+        */
+       private function newSerializationOptions() {
+               $options = new SerializationOptions();
+
+               // See mw.wikibase.lua. This is the only way to inject values 
into mw.wikibase.label( ),
+               // so any customized Lua modules can access labels of another 
entity written in another variant,
+               // unless we give them the ability to getEntity() any entity by 
specifying its ID, not just self.
+               $chain = $this->fallbackChainFactory->newFromLanguage(
+                       $this->language,
+                       LanguageFallbackChainFactory::FALLBACK_SELF | 
LanguageFallbackChainFactory::FALLBACK_VARIANTS
+               );
+
+               $languages = $this->languageCodes + array( 
$this->language->getCode() => $chain );
+
+               // SerializationOptions accepts mixed types of keys happily.
+               $options->setLanguages( $languages );
+
+               return $options;
+       }
+
+}
\ No newline at end of file
diff --git 
a/extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
 
b/extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
index bf95c3f..3727cd8 100644
--- 
a/extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
+++ 
b/extensions/Wikibase/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
@@ -1,5 +1,6 @@
 <?php
 
+use Wikibase\Client\Scribunto\EntityAccessor;
 use Wikibase\Client\Scribunto\WikibaseLuaBindings;
 use Wikibase\Client\Usage\ParserOutputUsageAccumulator;
 use Wikibase\Client\WikibaseClient;
@@ -16,34 +17,66 @@
  *
  * @licence GNU GPL v2+
  * @author Jens Ohlig < jens.oh...@wikimedia.de >
+ * @author Marius Hoch < h...@online.de >
  */
 class Scribunto_LuaWikibaseLibrary extends Scribunto_LuaLibraryBase {
 
        /**
-        * @var WikibaseLuaBindings
+        * @var WikibaseLuaBindings|null
         */
-       private $wbLibrary;
+       private $luaBindings;
 
-       private function getImplementation() {
-               if ( !$this->wbLibrary ) {
-                       $this->wbLibrary = $this->newImplementation();
+       /**
+        * @var EntityAccessor
+        */
+       private $entityAccessor;
+
+       private function getLuaBindings() {
+               if ( !$this->luaBindings ) {
+                       $this->luaBindings = $this->newLuaBindings();
                }
 
-               return $this->wbLibrary;
+               return $this->luaBindings;
        }
 
-       private function newImplementation() {
+       private function getEntityAccessor() {
+               if ( !$this->entityAccessor ) {
+                       $this->entityAccessor = $this->newEntityAccessor();
+               }
+
+               return $this->entityAccessor;
+       }
+
+       private function getLanguage() {
                // For the language we need $wgContLang, not parser target 
language or anything else.
                // See Scribunto_LuaLanguageLibrary::getContLangCode().
                global $wgContLang;
-               $language = $wgContLang;
+               return $wgContLang;
+       }
 
+       private function newEntityAccessor() {
+               $wikibaseClient = WikibaseClient::getDefaultInstance();
+
+               $entityLookup = $wikibaseClient->getStore()->getEntityLookup();
+
+               return new EntityAccessor(
+                       $wikibaseClient->getEntityIdParser(),
+                       $entityLookup,
+                       new ParserOutputUsageAccumulator( 
$this->getParser()->getOutput() ),
+                       $wikibaseClient->getLanguageFallbackChainFactory(),
+                       Utils::getLanguageCodes(),
+                       $this->getLanguage(),
+                       $wikibaseClient->getPropertyDataTypeLookup()
+               );
+       }
+
+       private function newLuaBindings() {
                $wikibaseClient = WikibaseClient::getDefaultInstance();
 
                $entityLookup = $wikibaseClient->getStore()->getEntityLookup();
 
                $fallbackChain = 
$wikibaseClient->getLanguageFallbackChainFactory()->newFromLanguage(
-                       $language,
+                       $this->getLanguage(),
                        LanguageFallbackChainFactory::FALLBACK_SELF | 
LanguageFallbackChainFactory::FALLBACK_VARIANTS
                );
 
@@ -56,13 +89,9 @@
                        $wikibaseClient->getEntityIdParser(),
                        $entityLookup,
                        $wikibaseClient->getStore()->getSiteLinkLookup(),
-                       $wikibaseClient->getLanguageFallbackChainFactory(),
-                       $language,
                        $wikibaseClient->getSettings(),
-                       $wikibaseClient->getPropertyDataTypeLookup(),
                        $labelLookup,
                        new ParserOutputUsageAccumulator( 
$this->getParser()->getOutput() ),
-                       Utils::getLanguageCodes(),
                        $wikibaseClient->getSettings()->getSetting( 
'siteGlobalID' )
                );
        }
@@ -104,7 +133,7 @@
                $this->checkType( 'getEntity', 1, $prefixedEntityId, 'string' );
                $this->checkType( 'getEntity', 2, $legacyStyle, 'boolean' );
                try {
-                       $entityArr = $this->getImplementation()->getEntity( 
$prefixedEntityId, $legacyStyle );
+                       $entityArr = $this->getEntityAccessor()->getEntity( 
$prefixedEntityId, $legacyStyle );
                        return array( $entityArr );
                }
                catch ( EntityIdParsingException $e ) {
@@ -126,7 +155,7 @@
         */
        public function getEntityId( $pageTitle = null ) {
                $this->checkType( 'getEntityByTitle', 1, $pageTitle, 'string' );
-               return array( $this->getImplementation()->getEntityId( 
$pageTitle ) );
+               return array( $this->getLuaBindings()->getEntityId( $pageTitle 
) );
        }
 
        /**
@@ -137,7 +166,7 @@
         * @return string[]
         */
        public function getGlobalSiteId() {
-               return array( $this->getImplementation()->getGlobalSiteId() );
+               return array( $this->getLuaBindings()->getGlobalSiteId() );
        }
 
        /**
@@ -151,7 +180,7 @@
         */
        public function getSetting( $setting ) {
                $this->checkType( 'setting', 1, $setting, 'string' );
-               return array( $this->getImplementation()->getSetting( $setting 
) );
+               return array( $this->getLuaBindings()->getSetting( $setting ) );
        }
 
        /**
@@ -165,7 +194,7 @@
         */
        public function getLabel( $prefixedEntityId ) {
                $this->checkType( 'getLabel', 1, $prefixedEntityId, 'string' );
-               return array( $this->getImplementation()->getLabel( 
$prefixedEntityId ) );
+               return array( $this->getLuaBindings()->getLabel( 
$prefixedEntityId ) );
        }
 
        /**
@@ -179,6 +208,6 @@
         */
        public function getSiteLinkPageName( $prefixedEntityId ) {
                $this->checkType( 'getSiteLinkPageName', 1, $prefixedEntityId, 
'string' );
-               return array( $this->getImplementation()->getSiteLinkPageName( 
$prefixedEntityId ) );
+               return array( $this->getLuaBindings()->getSiteLinkPageName( 
$prefixedEntityId ) );
        }
 }
diff --git 
a/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php 
b/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php
index 1bea937..d7e3a6c 100644
--- a/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php
+++ b/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php
@@ -3,19 +3,12 @@
 namespace Wikibase\Client\Scribunto;
 
 use InvalidArgumentException;
-use Language;
 use OutOfBoundsException;
 use Wikibase\Client\Usage\UsageAccumulator;
-use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\EntityIdParser;
 use Wikibase\DataModel\Entity\EntityIdParsingException;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
-use Wikibase\LanguageFallbackChainFactory;
-use Wikibase\Lib\Serializers\SerializationOptions;
-use Wikibase\Lib\Serializers\Serializer;
-use Wikibase\Lib\Serializers\SerializerFactory;
 use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Lib\Store\LabelLookup;
 use Wikibase\Lib\Store\SiteLinkLookup;
@@ -23,7 +16,8 @@
 use Wikibase\SettingsArray;
 
 /**
- * Actual implementations of the functions to access Wikibase through the 
Scribunto extension
+ * Actual implementations of various functions to access Wikibase functionality
+ * through Scribunto.
  *
  * @since 0.5
  *
@@ -49,34 +43,14 @@
        private $siteLinkTable;
 
        /**
-        * @var LanguageFallbackChainFactory
-        */
-       private $fallbackChainFactory;
-
-       /**
-        * @var Language
-        */
-       private $language;
-
-       /**
         * @var SettingsArray
         */
        private $settings;
 
        /**
-        * @var string[]
-        */
-       private $languageCodes;
-
-       /**
         * @var string
         */
        private $siteId;
-
-       /**
-        * @var PropertyDataTypeLookup
-        */
-       private $dataTypeLookup;
 
        /**
         * @var LabelLookup
@@ -89,165 +63,30 @@
        private $usageAccumulator;
 
        /**
-        * @var SerializationOptions
-        */
-       private $serializationOptions = null;
-
-       /**
         * @param EntityIdParser $entityIdParser
         * @param EntityLookup $entityLookup
         * @param SiteLinkLookup $siteLinkTable
-        * @param LanguageFallbackChainFactory $fallbackChainFactory
-        * @param Language $language
         * @param SettingsArray $settings
-        * @param PropertyDataTypeLookup $dataTypeLookup
         * @param LabelLookup $labelLookup
         * @param UsageAccumulator $usageAccumulator
-        * @param string[] $languageCodes
         * @param string $siteId
         */
        public function __construct(
                EntityIdParser $entityIdParser,
                EntityLookup $entityLookup,
                SiteLinkLookup $siteLinkTable,
-               LanguageFallbackChainFactory $fallbackChainFactory,
-               Language $language,
                SettingsArray $settings,
-               PropertyDataTypeLookup $dataTypeLookup,
                LabelLookup $labelLookup,
                UsageAccumulator $usageAccumulator,
-               $languageCodes,
                $siteId
        ) {
                $this->entityIdParser = $entityIdParser;
                $this->entityLookup = $entityLookup;
                $this->siteLinkTable = $siteLinkTable;
-               $this->fallbackChainFactory = $fallbackChainFactory;
-               $this->language = $language;
                $this->settings = $settings;
-               $this->dataTypeLookup = $dataTypeLookup;
                $this->labelLookup = $labelLookup;
-               $this->languageCodes = $languageCodes;
                $this->siteId = $siteId;
                $this->usageAccumulator = $usageAccumulator;
-       }
-
-       /**
-        * Recursively renumber a serialized array in place, so it is indexed 
at 1, not 0.
-        * Just like Lua wants it.
-        *
-        * @since 0.5
-        *
-        * @param array &$entityArr
-        */
-       public function renumber( array &$entityArr ) {
-               foreach( $entityArr as &$value ) {
-                       if ( !is_array( $value ) ) {
-                               continue;
-                       }
-                       if ( array_key_exists( 0, $value ) ) {
-                               $value = array_combine( range( 1, count( $value 
) ), array_values( $value ) );
-                       }
-                       $this->renumber( $value );
-               }
-       }
-
-       /**
-        * Get entity from prefixed ID (e.g. "Q23") and return it as serialized 
array.
-        *
-        * @since 0.5
-        *
-        * @param string $prefixedEntityId
-        * @param bool $legacyStyle Whether to return a legacy style entity
-        *
-        * @return array
-        */
-       public function getEntity( $prefixedEntityId, $legacyStyle = false ) {
-               $prefixedEntityId = trim( $prefixedEntityId );
-
-               $entityId = $this->entityIdParser->parse( $prefixedEntityId );
-
-               $entityObject = $this->entityLookup->getEntity( $entityId );
-
-               if ( $entityObject === null ) {
-                       return null;
-               }
-
-               $serializer = $this->getEntitySerializer( $entityObject, 
$legacyStyle );
-
-               $entityArr = $serializer->getSerialized( $entityObject );
-
-               if ( $legacyStyle ) {
-                       // Mark the output as Legacy so that we can easily 
distinguish the styles in Lua
-                       $entityArr['schemaVersion'] = 1;
-               } else {
-                       // Renumber the entity as Lua uses 1-based array 
indexing
-                       $this->renumber( $entityArr );
-                       $entityArr['schemaVersion'] = 2;
-               }
-
-               $this->usageAccumulator->addAllUsage( $entityId );
-               return $entityArr;
-       }
-
-       /**
-        * @since 0.5
-        *
-        * @param EntityDocument $entityObject
-        * @param bool $lowerCaseIds Whether to also use lower case ids
-        *
-        * @return Serializer
-        */
-       private function getEntitySerializer( EntityDocument $entityObject, 
$lowerCaseIds ) {
-               $options = $this->getSerializationOptions( $lowerCaseIds );
-               $serializerFactory = new SerializerFactory( $options, 
$this->dataTypeLookup );
-
-               return $serializerFactory->newSerializerForObject( 
$entityObject, $options );
-       }
-
-       /**
-        * @param bool $lowerCaseIds
-        *
-        * @return SerializationOptions
-        */
-       private function getSerializationOptions( $lowerCaseIds ) {
-               if ( $this->serializationOptions === null ) {
-                       $this->serializationOptions = 
$this->newSerializationOptions();
-               }
-
-               // Using "ID_KEYS_BOTH" here means that all lists of Snaks or 
Claims will be listed
-               // twice, once with a lower case key and once with an upper 
case key.
-               // This is a B/C hack to allow existing lua code to use 
hardcoded IDs
-               // in both lower (legacy) and upper case.
-               if ( $lowerCaseIds ) {
-                       $this->serializationOptions->setIdKeyMode( 
SerializationOptions::ID_KEYS_BOTH );
-               } else {
-                       $this->serializationOptions->setIdKeyMode( 
SerializationOptions::ID_KEYS_UPPER );
-               }
-
-               return $this->serializationOptions;
-       }
-
-       /**
-        * @return SerializationOptions
-        */
-       private function newSerializationOptions() {
-               $options = new SerializationOptions();
-
-               // See mw.wikibase.lua. This is the only way to inject values 
into mw.wikibase.label( ),
-               // so any customized Lua modules can access labels of another 
entity written in another variant,
-               // unless we give them the ability to getEntity() any entity by 
specifying its ID, not just self.
-               $chain = $this->fallbackChainFactory->newFromLanguage(
-                       $this->language,
-                       LanguageFallbackChainFactory::FALLBACK_SELF | 
LanguageFallbackChainFactory::FALLBACK_VARIANTS
-               );
-
-               $languages = $this->languageCodes + array( 
$this->language->getCode() => $chain );
-
-               // SerializationOptions accepts mixed types of keys happily.
-               $options->setLanguages( $languages );
-
-               return $options;
        }
 
        /**
diff --git 
a/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
 
b/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
index b566eb5..b5c2248 100644
--- 
a/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
+++ 
b/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnDeleteTest.php
@@ -4,6 +4,7 @@
 
 use Title;
 use User;
+use JobSpecification;
 use Wikibase\Client\UpdateRepo\UpdateRepoOnDelete;
 use Wikibase\DataModel\Entity\ItemId;
 
@@ -68,20 +69,32 @@
        /**
         * Get a JobQueueGroup mock for the use in UpdateRepo::injectJob.
         *
-        * @param \Job $expectedJob The job that is expected to be pushed
-        * @param bool $success Whether the push will succeed
-        *
         * @return object
         */
-       protected function getJobQueueGroupMock( $expectedJob, $success ) {
+       protected function getJobQueueGroupMock() {
                $jobQueueGroupMock = $this->getMockBuilder( '\JobQueueGroup' )
                        ->disableOriginalConstructor()
                        ->getMock();
 
+               $self = $this; // PHP 5.3 compat
                $jobQueueGroupMock->expects( $this->once() )
                        ->method( 'push' )
-                       ->will( $this->returnValue( $success ) )
-                       ->with( $this->equalTo( $expectedJob ) );
+                       ->will(
+                               $this->returnCallback( function( 
JobSpecification $job ) use( $self ) {
+                                       $self->verifyJob( $job );
+                               } )
+                       );
+
+               // Use JobQueueRedis over here, as mocking abstract classes 
sucks
+               // and it doesn't matter anyway
+               $jobQueue = $this->getMockBuilder( '\JobQueueRedis' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $jobQueueGroupMock->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( $this->equalTo( 'UpdateRepoOnDelete' ) )
+                       ->will( $this->returnValue( $jobQueue ) );
 
                return $jobQueueGroupMock;
        }
@@ -93,11 +106,11 @@
        }
 
        /**
-        * Create a new job and verify the set params
+        * Verify a created job
+        *
+        * @param Job $job
         */
-       public function testCreateJob() {
-               $updateRepo = $this->getNewUpdateRepoOnDelete();
-               $job = $updateRepo->createJob();
+       public function verifyJob( JobSpecification $job ) {
                $itemId = new ItemId( 'Q123' );
 
                $data = $this->getFakeData();
@@ -113,9 +126,8 @@
 
        public function testInjectJob() {
                $updateRepo = $this->getNewUpdateRepoOnDelete();
-               $job = $updateRepo->createJob();
 
-               $jobQueueGroupMock = $this->getJobQueueGroupMock( $job, true );
+               $jobQueueGroupMock = $this->getJobQueueGroupMock( true );
 
                $updateRepo->injectJob( $jobQueueGroupMock );
        }
diff --git 
a/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
 
b/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
index 7d03bee..d021553 100644
--- 
a/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
+++ 
b/extensions/Wikibase/client/tests/phpunit/includes/UpdateRepo/UpdateRepoOnMoveTest.php
@@ -2,6 +2,7 @@
 
 namespace Wikibase\Client\Tests\UpdateRepo;
 
+use JobSpecification;
 use Wikibase\Client\UpdateRepo\UpdateRepoOnMove;
 use Wikibase\DataModel\Entity\ItemId;
 
@@ -70,20 +71,36 @@
        /**
         * Get a JobQueueGroup mock for the use in UpdateRepo::injectJob.
         *
-        * @param \Job $expectedJob The job that is expected to be pushed
-        * @param bool $success Whether the push will succeed
-        *
         * @return object
         */
-       private function getJobQueueGroupMock( $expectedJob, $success ) {
+       protected function getJobQueueGroupMock() {
                $jobQueueGroupMock = $this->getMockBuilder( '\JobQueueGroup' )
                        ->disableOriginalConstructor()
                        ->getMock();
 
+               $self = $this; // PHP 5.3 compat
                $jobQueueGroupMock->expects( $this->once() )
                        ->method( 'push' )
-                       ->will( $this->returnValue( $success ) )
-                       ->with( $this->equalTo( $expectedJob ) );
+                       ->will(
+                               $this->returnCallback( function( 
JobSpecification $job ) use( $self ) {
+                                       $self->verifyJob( $job );
+                               } )
+                       );
+
+               // Use JobQueueRedis over here, as mocking abstract classes 
sucks
+               // and it doesn't matter anyway
+               $jobQueue = $this->getMockBuilder( '\JobQueueRedis' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+
+               $jobQueue->expects( $this->any() )
+                       ->method( 'delayedJobsEnabled' )
+                       ->will( $this->returnValue( true ) );
+
+               $jobQueueGroupMock->expects( $this->once() )
+                       ->method( 'get' )
+                       ->with( $this->equalTo( 'UpdateRepoOnMove' ) )
+                       ->will( $this->returnValue( $jobQueue ) );
 
                return $jobQueueGroupMock;
        }
@@ -95,11 +112,11 @@
        }
 
        /**
-        * Create a new job and verify the set params
+        * Verify a created job
+        *
+        * @param Job $job
         */
-       public function testCreateJob() {
-               $updateRepo = $this->getNewLocal();
-               $job = $updateRepo->createJob();
+       public function verifyJob( JobSpecification $job ) {
                $itemId = new ItemId( 'Q123' );
 
                $moveData = $this->getFakeMoveData();
@@ -116,9 +133,8 @@
 
        public function testInjectJob() {
                $updateRepo = $this->getNewLocal();
-               $job = $updateRepo->createJob();
 
-               $jobQueueGroupMock = $this->getJobQueueGroupMock( $job, true );
+               $jobQueueGroupMock = $this->getJobQueueGroupMock( true );
 
                $updateRepo->injectJob( $jobQueueGroupMock );
        }
diff --git 
a/extensions/Wikibase/client/tests/phpunit/includes/scribunto/EntityAccessorTest.php
 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/EntityAccessorTest.php
new file mode 100644
index 0000000..f8f9e23
--- /dev/null
+++ 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/EntityAccessorTest.php
@@ -0,0 +1,157 @@
+<?php
+
+namespace Wikibase\Client\Tests\Scribunto;
+
+use Language;
+use Wikibase\Client\Scribunto\EntityAccessor;
+use Wikibase\Client\Usage\EntityUsage;
+use Wikibase\Client\Usage\HashUsageAccumulator;
+use Wikibase\Client\Usage\UsageAccumulator;
+use Wikibase\DataModel\Entity\BasicEntityIdParser;
+use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\DataModel\Entity\Item;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\LanguageFallbackChainFactory;
+use Wikibase\Lib\Store\EntityLookup;
+use Wikibase\Test\MockRepository;
+
+/**
+ * @covers Wikibase\Client\Scribunto\EntityAccessor
+ *
+ * @group Wikibase
+ * @group WikibaseClient
+ * @group WikibaseScribunto
+ *
+ * @license GNU GPL v2+
+ * @author Marius Hoch < h...@online.de >
+ */
+class EntityAccessorTest extends \PHPUnit_Framework_TestCase {
+
+       public function testConstructor() {
+               $entityAccessor = $this->getEntityAccessor();
+
+               $this->assertInstanceOf(
+                       'Wikibase\Client\Scribunto\EntityAccessor',
+                       $entityAccessor
+               );
+       }
+
+       private function getEntityAccessor(
+               EntityLookup $entityLookup = null,
+               UsageAccumulator $usageAccumulator = null
+       ) {
+               $language = new Language( 'en' );
+
+               $propertyDataTypeLookup = $this->getMock( 
'Wikibase\DataModel\Entity\PropertyDataTypeLookup' );
+               $propertyDataTypeLookup->expects( $this->any() )
+                       ->method( 'getDataTypeIdForProperty' )
+                       ->will( $this->returnValue( 'structured-cat' ) );
+
+               return new EntityAccessor(
+                       new BasicEntityIdParser(),
+                       $entityLookup ?: new MockRepository(),
+                       $usageAccumulator ? $usageAccumulator : new 
HashUsageAccumulator(),
+                       new LanguageFallbackChainFactory(),
+                       array( 'de', 'en', 'es', 'ja' ),
+                       $language,
+                       $propertyDataTypeLookup
+               );
+       }
+
+       private function hasUsage( $actualUsages, EntityId $entityId, $aspect ) 
{
+               $usage = new EntityUsage( $entityId, $aspect );
+               $key = $usage->getIdentityString();
+               return isset( $actualUsages[$key] );
+       }
+
+       /**
+        * @dataProvider getEntityProvider
+        */
+       public function testGetEntity( array $expected, Item $item, 
EntityLookup $entityLookup ) {
+               $prefixedId = $item->getId()->getSerialization();
+               $entityAccessor = $this->getEntityAccessor( $entityLookup );
+
+               $entityArr = $entityAccessor->getEntity( $prefixedId );
+               $actual = is_array( $entityArr ) ? array_keys( $entityArr ) : 
array();
+               $this->assertEquals( $expected, $actual );
+       }
+
+       public function testGetEntity_usage() {
+               $item = $this->getItem();
+               $itemId = $item->getId();
+
+               $entityLookup = new MockRepository();
+               $entityLookup->putEntity( $item );
+
+               $usages = new HashUsageAccumulator();
+               $entityAccessor = $this->getEntityAccessor( $entityLookup, 
$usages );
+
+               $entityAccessor->getEntity( $itemId->getSerialization() );
+               $this->assertTrue(
+                       $this->hasUsage($usages->getUsages(), $item->getId(), 
EntityUsage::ALL_USAGE ), 'all usage'
+               );
+       }
+
+       public function getEntityProvider() {
+               $item = $this->getItem();
+
+               $entityLookup = new MockRepository();
+               $entityLookup->putEntity( $item );
+
+               $item2 = $item->newEmpty();
+               $item2->setId( new ItemId( 'Q9999' ) );
+
+               return array(
+                       array( array( 'id', 'type', 'descriptions', 'labels', 
'sitelinks', 'schemaVersion' ), $item, $entityLookup ),
+                       array( array(), $item2, $entityLookup )
+               );
+       }
+
+       protected function getItem() {
+               $item = new Item( new ItemId( 'Q666' ) );
+               $item->setLabel( 'en', 'Beer' );
+               $item->setDescription( 'en', 'yummy beverage' );
+               $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Beer' );
+               $item->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Bier' );
+
+               return $item;
+       }
+
+       /**
+        * @dataProvider provideZeroIndexedArray
+        */
+       public function testZeroIndexArray ( array $array, array $expected ) {
+               $this->getEntityAccessor()->renumber( $array );
+
+               $this->assertSame( $expected, $array );
+       }
+
+       public function provideZeroIndexedArray() {
+               return array(
+                       array(
+                               array( 'nyancat' => array( 0 => 'nyan', 1 => 
'cat' ) ),
+                               array( 'nyancat' => array( 1 => 'nyan', 2 => 
'cat' ) )
+                       ),
+                       array(
+                               array( array( 'a', 'b' ) ),
+                               array( array( 1 => 'a', 2 => 'b' ) )
+                       ),
+                       array(
+                               // Nested arrays
+                               array( array( 'a', 'b', array( 'c', 'd' ) ) ),
+                               array( array( 1 => 'a', 2 => 'b', 3 => array( 1 
=> 'c', 2 => 'd' ) ) )
+                       ),
+                       array(
+                               // Already 1-based
+                               array( array( 1 => 'a', 4 => 'c', 3 => 'b' ) ),
+                               array( array( 1 => 'a', 4 => 'c', 3 => 'b' ) )
+                       ),
+                       array(
+                               // Associative array
+                               array( array( 'foo' => 'bar', 1337 => 
'Wikidata' ) ),
+                               array( array( 'foo' => 'bar', 1337 => 
'Wikidata' ) )
+                       ),
+               );
+       }
+
+}
diff --git 
a/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
index 392f426..a516d0a 100644
--- 
a/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
+++ 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTestCase.php
@@ -86,6 +86,7 @@
        }
 
        protected function setUp() {
+               parent::setUp();
                self::doMock();
 
                $wikibaseClient = WikibaseClient::getDefaultInstance();
@@ -97,7 +98,6 @@
                );
 
                $this->setMwGlobals( 'wgContLang', Language::factory( 'de' ) );
-               parent::setUp();
        }
 
        protected function tearDown() {
diff --git 
a/extensions/Wikibase/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
index 7e54dd4..c822b42 100644
--- 
a/extensions/Wikibase/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
+++ 
b/extensions/Wikibase/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
@@ -2,7 +2,6 @@
 
 namespace Wikibase\Client\Tests\Scribunto;
 
-use Language;
 use Wikibase\Client\Scribunto\WikibaseLuaBindings;
 use Wikibase\Client\Usage\EntityUsage;
 use Wikibase\Client\Usage\HashUsageAccumulator;
@@ -12,7 +11,6 @@
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Term\Term;
-use Wikibase\LanguageFallbackChainFactory;
 use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\SettingsArray;
 use Wikibase\Test\MockRepository;
@@ -44,7 +42,6 @@
                EntityLookup $entityLookup = null,
                UsageAccumulator $usageAccumulator = null
        ) {
-               $language = new Language( "en" );
 
                $siteLinkTable = $this->getMockBuilder( 
'Wikibase\Lib\Store\SiteLinkTable' )
                        ->disableOriginalConstructor()
@@ -57,11 +54,6 @@
                                } )
                        );
 
-               $propertyDataTypeLookup = $this->getMock( 
'Wikibase\DataModel\Entity\PropertyDataTypeLookup' );
-               $propertyDataTypeLookup->expects( $this->any() )
-                       ->method( 'getDataTypeIdForProperty' )
-                       ->will( $this->returnValue( 'structured-cat' ) );
-
                $labelLookup = $this->getMock( 'Wikibase\Lib\Store\LabelLookup' 
);
                $labelLookup->expects( $this->any() )
                        ->method( 'getLabel' )
@@ -71,13 +63,9 @@
                        new BasicEntityIdParser(),
                        $entityLookup ?: new MockRepository(),
                        $siteLinkTable,
-                       new LanguageFallbackChainFactory(),
-                       $language, // language
                        new SettingsArray(),
-                       $propertyDataTypeLookup,
                        $labelLookup,
                        $usageAccumulator ? $usageAccumulator : new 
HashUsageAccumulator(),
-                       array( 'de', 'en', 'es', 'ja' ),
                        "enwiki" // siteId
                );
        }
@@ -86,47 +74,6 @@
                $usage = new EntityUsage( $entityId, $aspect );
                $key = $usage->getIdentityString();
                return isset( $actualUsages[$key] );
-       }
-
-       /**
-        * @dataProvider getEntityProvider
-        */
-       public function testGetEntity( array $expected, Item $item, 
EntityLookup $entityLookup ) {
-               $prefixedId = $item->getId()->getSerialization();
-               $wikibaseLuaBindings = $this->getWikibaseLuaBindings( 
$entityLookup );
-
-               $entityArr = $wikibaseLuaBindings->getEntity( $prefixedId );
-               $actual = is_array( $entityArr ) ? array_keys( $entityArr ) : 
array();
-               $this->assertEquals( $expected, $actual );
-       }
-
-       public function testGetEntity_usage() {
-               $item = $this->getItem();
-               $itemId = $item->getId();
-
-               $entityLookup = new MockRepository();
-               $entityLookup->putEntity( $item );
-
-               $usages = new HashUsageAccumulator();
-               $wikibaseLuaBindings = $this->getWikibaseLuaBindings( 
$entityLookup, $usages );
-
-               $wikibaseLuaBindings->getEntity( $itemId->getSerialization() );
-               $this->assertTrue( $this->hasUsage( $usages->getUsages(), 
$item->getId(), EntityUsage::ALL_USAGE ), 'all usage' );
-       }
-
-       public function getEntityProvider() {
-               $item = $this->getItem();
-
-               $entityLookup = new MockRepository();
-               $entityLookup->putEntity( $item );
-
-               $item2 = $item->newEmpty();
-               $item2->setId( new ItemId( 'Q9999' ) );
-
-               return array(
-                       array( array( 'id', 'type', 'descriptions', 'labels', 
'sitelinks', 'schemaVersion' ), $item, $entityLookup ),
-                       array( array(), $item2, $entityLookup )
-               );
        }
 
        public function testGetEntityId() {
@@ -232,42 +179,4 @@
 
                return $item;
        }
-
-       /**
-        * @dataProvider provideZeroIndexedArray
-        */
-       public function testZeroIndexArray ( array $array, array $expected ) {
-               $this->getWikibaseLuaBindings()->renumber( $array );
-
-               $this->assertSame( $expected, $array );
-       }
-
-       public function provideZeroIndexedArray() {
-               return array(
-                       array(
-                               array( 'nyancat' => array( 0 => 'nyan', 1 => 
'cat' ) ),
-                               array( 'nyancat' => array( 1 => 'nyan', 2 => 
'cat' ) )
-                       ),
-                       array(
-                               array( array( 'a', 'b' ) ),
-                               array( array( 1 => 'a', 2 => 'b' ) )
-                       ),
-                       array(
-                               // Nested arrays
-                               array( array( 'a', 'b', array( 'c', 'd' ) ) ),
-                               array( array( 1 => 'a', 2 => 'b', 3 => array( 1 
=> 'c', 2 => 'd' ) ) )
-                       ),
-                       array(
-                               // Already 1-based
-                               array( array( 1 => 'a', 4 => 'c', 3 => 'b' ) ),
-                               array( array( 1 => 'a', 4 => 'c', 3 => 'b' ) )
-                       ),
-                       array(
-                               // Associative array
-                               array( array( 'foo' => 'bar', 1337 => 
'Wikidata' ) ),
-                               array( array( 'foo' => 'bar', 1337 => 
'Wikidata' ) )
-                       ),
-               );
-       }
-
 }
diff --git a/extensions/Wikibase/lib/maintenance/populateSitesTable.php 
b/extensions/Wikibase/lib/maintenance/populateSitesTable.php
index da3cb59..75ea094 100644
--- a/extensions/Wikibase/lib/maintenance/populateSitesTable.php
+++ b/extensions/Wikibase/lib/maintenance/populateSitesTable.php
@@ -3,6 +3,14 @@
 $basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH' 
) : __DIR__ . '/../../../..';
 require_once $basePath . '/maintenance/Maintenance.php';
 
+if ( !class_exists( 'SitesBuilder' ) ) {
+       require_once __DIR__ . '/../includes/sites/SitesBuilder.php';
+}
+
+if ( !class_exists( 'SiteMatrixParser' ) ) {
+       require_once __DIR__ . '/../includes/sites/SiteMatrixParser.php';
+}
+
 /**
  * Maintenance script for populating the Sites table from another wiki that 
runs the
  * SiteMatrix extension.
diff --git a/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php 
b/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php
index 35b82c0..206e69d 100644
--- a/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php
+++ b/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoJob.php
@@ -177,7 +177,7 @@
                );
 
                if ( !$status->isOK() ) {
-                       wfDebugLog( __CLASS__, __FUNCTION__ . ": attemptSave 
failed: " . $status->getMessage()->text() );
+                       wfDebugLog( __CLASS__, __FUNCTION__ . ": attemptSave 
for " . $item->getId()->getSerialization() . " failed: " . 
$status->getMessage()->text() );
                }
 
                wfProfileOut( __METHOD__ );
diff --git 
a/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php 
b/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php
index a5407fa..317dbcf 100644
--- a/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php
+++ b/extensions/Wikibase/repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php
@@ -31,6 +31,11 @@
        private $siteStore;
 
        /**
+        * @var string|bool|null
+        */
+       private $normalizedPageName = null;
+
+       /**
         * Constructs a UpdateRepoOnMoveJob propagating a page move to the repo
         *
         * @note: This is for use by Job::factory, don't call it directly;
@@ -115,6 +120,27 @@
        }
 
        /**
+        * @return string|bool False in case the normalization failed
+        */
+       private function getNormalizedPageName() {
+               if ( $this->normalizedPageName === null ) {
+                       $params = $this->getParams();
+                       $newPage = $params['newTitle'];
+                       $siteId = $params['siteId'];
+
+                       $site = $this->siteStore->getSite( $siteId );
+                       $this->normalizedPageName = $site->normalizePageName( 
$newPage );
+
+                       if ( $this->normalizedPageName === false ) {
+                               wfDebugLog( 'UpdateRepo', "OnMove: Normalizing 
the page name $newPage on $siteId failed" );
+                       }
+
+               }
+
+               return $this->normalizedPageName;
+       }
+
+       /**
         * Whether the propagated update is valid (and thus should be applied)
         *
         * @param Item $item
@@ -126,7 +152,6 @@
                $params = $this->getParams();
                $siteId = $params['siteId'];
                $oldPage = $params['oldTitle'];
-               $newPage = $params['newTitle'];
 
                $oldSiteLink = $this->getSiteLink( $item, $siteId );
                if ( !$oldSiteLink || $oldSiteLink->getPageName() !== $oldPage 
) {
@@ -136,10 +161,8 @@
                        return false;
                }
 
-               $site = $this->siteStore->getSite( $siteId );
-               // Normalize the name again, just in case the page has been 
updated in the mean time
-               if ( !$site || !$site->normalizePageName( $newPage ) ) {
-                       wfDebugLog( 'UpdateRepo', "OnMove: Normalizing the page 
name $newPage on $siteId failed" );
+               // Normalize the name, just in case the page has been updated 
in the mean time
+               if ( $this->getNormalizedPageName() === false ) {
                        wfProfileOut( __METHOD__ );
                        return false;
                }
@@ -157,14 +180,12 @@
        protected function applyChanges( Item $item ) {
                $params = $this->getParams();
                $siteId = $params['siteId'];
-               $newPage = $params['newTitle'];
 
                $oldSiteLink = $this->getSiteLink( $item, $siteId );
 
-               $site = $this->siteStore->getSite( $siteId );
                $siteLink = new SiteLink(
                        $siteId,
-                       $site->normalizePageName( $newPage ),
+                       $this->getNormalizedPageName(),
                        $oldSiteLink->getBadges() // Keep badges
                );
 
diff --git a/vendor/composer/autoload_classmap.php 
b/vendor/composer/autoload_classmap.php
index 5740a2c..f4788e0 100644
--- a/vendor/composer/autoload_classmap.php
+++ b/vendor/composer/autoload_classmap.php
@@ -336,6 +336,7 @@
     'Wikibase\\Client\\RecentChanges\\RevisionData' => $baseDir . 
'/extensions/Wikibase/client/includes/recentchanges/RevisionData.php',
     'Wikibase\\Client\\RepoItemLinkGenerator' => $baseDir . 
'/extensions/Wikibase/client/includes/RepoItemLinkGenerator.php',
     'Wikibase\\Client\\RepoLinker' => $baseDir . 
'/extensions/Wikibase/client/includes/RepoLinker.php',
+    'Wikibase\\Client\\Scribunto\\EntityAccessor' => $baseDir . 
'/extensions/Wikibase/client/includes/scribunto/EntityAccessor.php',
     'Wikibase\\Client\\Scribunto\\WikibaseLuaBindings' => $baseDir . 
'/extensions/Wikibase/client/includes/scribunto/WikibaseLuaBindings.php',
     'Wikibase\\Client\\Scribunto\\WikibaseLuaEntityBindings' => $baseDir . 
'/extensions/Wikibase/client/includes/scribunto/WikibaseLuaEntityBindings.php',
     'Wikibase\\Client\\Specials\\SpecialUnconnectedPages' => $baseDir . 
'/extensions/Wikibase/client/includes/specials/SpecialUnconnectedPages.php',
@@ -381,6 +382,7 @@
     'Wikibase\\Client\\Tests\\RecentChanges\\RevisionDataTest' => $baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/recentchanges/RevisionDataTest.php',
     'Wikibase\\Client\\Tests\\RepoItemLinkGeneratorTest' => $baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php',
     'Wikibase\\Client\\Tests\\RepoLinkerTest' => $baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/RepoLinkerTest.php',
+    'Wikibase\\Client\\Tests\\Scribunto\\EntityAccessorTest' => $baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/scribunto/EntityAccessorTest.php',
     
'Wikibase\\Client\\Tests\\Scribunto\\Scribunto_LuaWikibaseEntityLibraryTest' => 
$baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php',
     
'Wikibase\\Client\\Tests\\Scribunto\\Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest'
 => $baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryNoArbitraryAccessTest.php',
     'Wikibase\\Client\\Tests\\Scribunto\\Scribunto_LuaWikibaseLibraryTest' => 
$baseDir . 
'/extensions/Wikibase/client/tests/phpunit/includes/scribunto/Scribunto_LuaWikibaseLibraryTest.php',
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 6a5df9b..74ab5bc 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1321,17 +1321,17 @@
     },
     {
         "name": "wikibase/wikibase",
-        "version": "dev-wmf/1.25wmf16",
-        "version_normalized": "dev-wmf/1.25wmf16",
+        "version": "dev-wmf/1.25wmf19",
+        "version_normalized": "dev-wmf/1.25wmf19",
         "source": {
             "type": "git",
             "url": 
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git";,
-            "reference": "c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8"
+            "reference": "1e35501b1b81796eb811f6eed9f945df830df895"
         },
         "dist": {
             "type": "zip",
-            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8";,
-            "reference": "c2b41e462a7e05c1b1a99b4273ecfb89b020cbb8",
+            "url": 
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/1e35501b1b81796eb811f6eed9f945df830df895";,
+            "reference": "1e35501b1b81796eb811f6eed9f945df830df895",
             "shasum": ""
         },
         "require": {
@@ -1359,7 +1359,7 @@
         "conflict": {
             "mediawiki/mediawiki": "<1.23"
         },
-        "time": "2015-02-19 21:07:13",
+        "time": "2015-02-24 18:54:32",
         "type": "mediawiki-extension",
         "installation-source": "dist",
         "autoload": {

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

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

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

Reply via email to