[MediaWiki-commits] [Gerrit] Clean up DirectSqlStore implementation - change (mediawiki...Wikibase)

2014-12-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Clean up DirectSqlStore implementation
..


Clean up DirectSqlStore implementation

* Order all class properties:
  * Constructor parameters first,
  * then all other properties set in the constructor,
  * then the rest in unchanged order.
* Inline trivial new...() methods.
* More meaningful variable names.

Change-Id: Id046892c9872ff5b5761d4221fa2c59dac3efc9d
---
M client/includes/store/sql/DirectSqlStore.php
1 file changed, 81 insertions(+), 110 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/includes/store/sql/DirectSqlStore.php 
b/client/includes/store/sql/DirectSqlStore.php
index 61172f6..83f9a3e 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -41,6 +41,46 @@
 class DirectSqlStore implements ClientStore {
 
/**
+* @var EntityContentDataCodec
+*/
+   private $contentCodec;
+
+   /**
+* @var EntityIdParser
+*/
+   private $entityIdParser;
+
+   /**
+* @var string|bool The database name of the repo wiki or false for the 
local wiki
+*/
+   private $repoWiki;
+
+   /**
+* @var string
+*/
+   private $languageCode;
+
+   /**
+* @var string
+*/
+   private $cacheKeyPrefix;
+
+   /**
+* @var int
+*/
+   private $cacheType;
+
+   /**
+* @var int
+*/
+   private $cacheDuration;
+
+   /**
+* @var bool
+*/
+   private $useLegacyUsageIndex;
+
+   /**
 * @var EntityLookup|null
 */
private $entityRevisionLookup = null;
@@ -66,21 +106,6 @@
private $propertyInfoTable = null;
 
/**
-* @var EntityIdParser
-*/
-   private $entityIdParser;
-
-   /**
-* @var string|bool The database name of the repo wiki or false for the 
local wiki
-*/
-   private $repoWiki;
-
-   /**
-* @var string
-*/
-   private $languageCode;
-
-   /**
 * @var SiteLinkTable|null
 */
private $siteLinkTable = null;
@@ -99,31 +124,6 @@
 * @var Site|null
 */
private $site = null;
-
-   /**
-* @var string
-*/
-   private $cacheKeyPrefix;
-
-   /**
-* @var int
-*/
-   private $cacheType;
-
-   /**
-* @var int
-*/
-   private $cacheDuration;
-
-   /**
-* @var EntityContentDataCodec
-*/
-   private $contentCodec;
-
-   /**
-* @var bool
-*/
-   private $useLegacyUsageIndex;
 
/**
 * @var string
@@ -225,17 +225,10 @@
 */
public function getSiteLinkLookup() {
if ( $this-siteLinkTable === null ) {
-   $this-siteLinkTable = $this-newSiteLinkTable();
+   $this-siteLinkTable = new SiteLinkTable( 
'wb_items_per_site', true, $this-repoWiki );
}
 
return $this-siteLinkTable;
-   }
-
-   /**
-* @return SiteLinkLookup
-*/
-   private function newSiteLinkTable() {
-   return new SiteLinkTable( 'wb_items_per_site', true, 
$this-repoWiki );
}
 
/**
@@ -247,9 +240,9 @@
 */
public function getEntityLookup() {
$revisionLookup = $this-getEntityRevisionLookup();
-   $lookup = new RevisionBasedEntityLookup( $revisionLookup );
-   $lookup = new RedirectResolvingEntityLookup( $lookup );
-   return $lookup;
+   $revisionBasedLookup = new RevisionBasedEntityLookup( 
$revisionLookup );
+   $resolvingLookup = new RedirectResolvingEntityLookup( 
$revisionBasedLookup );
+   return $resolvingLookup;
}
 
/**
@@ -272,28 +265,28 @@
// NOTE: Keep cache key in sync with 
SqlStore::newEntityRevisionLookup in WikibaseRepo
$cacheKeyPrefix = $this-cacheKeyPrefix . 
':WikiPageEntityRevisionLookup';
 
-   $lookup = new WikiPageEntityRevisionLookup(
+   $rawLookup = new WikiPageEntityRevisionLookup(
$this-contentCodec,
$this-entityIdParser,
$this-repoWiki
);
 
// Lower caching layer using persistent cache (e.g. memcached).
-   // We need to verify the revision ID against the database to 
avoid stale data.
-   $lookup = new CachingEntityRevisionLookup(
-   $lookup,
+   $persistentCachingLookup = new CachingEntityRevisionLookup(
+   $rawLookup,
wfGetCache( $this-cacheType ),

[MediaWiki-commits] [Gerrit] Clean up DirectSqlStore implementation - change (mediawiki...Wikibase)

2014-12-09 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Clean up DirectSqlStore implementation
..

Clean up DirectSqlStore implementation

* Order all class properties:
  * Constructor parameters first,
  * then all other properties set in the constructor,
  * then the rest in unchanged order.
* Inline trivial new...() methods.
* More meaningful variable names.

Change-Id: Id046892c9872ff5b5761d4221fa2c59dac3efc9d
---
M client/includes/store/sql/DirectSqlStore.php
1 file changed, 81 insertions(+), 110 deletions(-)


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

diff --git a/client/includes/store/sql/DirectSqlStore.php 
b/client/includes/store/sql/DirectSqlStore.php
index e4aae01..0029c69 100644
--- a/client/includes/store/sql/DirectSqlStore.php
+++ b/client/includes/store/sql/DirectSqlStore.php
@@ -41,6 +41,46 @@
 class DirectSqlStore implements ClientStore {
 
/**
+* @var EntityContentDataCodec
+*/
+   private $contentCodec;
+
+   /**
+* @var EntityIdParser
+*/
+   private $entityIdParser;
+
+   /**
+* @var string|bool The database name of the repo wiki or false for the 
local wiki
+*/
+   private $repoWiki;
+
+   /**
+* @var string
+*/
+   private $languageCode;
+
+   /**
+* @var string
+*/
+   private $cacheKeyPrefix;
+
+   /**
+* @var int
+*/
+   private $cacheType;
+
+   /**
+* @var int
+*/
+   private $cacheDuration;
+
+   /**
+* @var bool
+*/
+   private $useLegacyUsageIndex;
+
+   /**
 * @var EntityLookup|null
 */
private $entityRevisionLookup = null;
@@ -66,21 +106,6 @@
private $propertyInfoTable = null;
 
/**
-* @var EntityIdParser
-*/
-   private $entityIdParser;
-
-   /**
-* @var string|bool The database name of the repo wiki or false for the 
local wiki
-*/
-   private $repoWiki;
-
-   /**
-* @var string
-*/
-   private $languageCode;
-
-   /**
 * @var SiteLinkTable|null
 */
private $siteLinkTable = null;
@@ -99,31 +124,6 @@
 * @var Site|null
 */
private $site = null;
-
-   /**
-* @var string
-*/
-   private $cacheKeyPrefix;
-
-   /**
-* @var int
-*/
-   private $cacheType;
-
-   /**
-* @var int
-*/
-   private $cacheDuration;
-
-   /**
-* @var EntityContentDataCodec
-*/
-   private $contentCodec;
-
-   /**
-* @var bool
-*/
-   private $useLegacyUsageIndex;
 
/**
 * @param EntityContentDataCodec $contentCodec
@@ -245,17 +245,10 @@
 */
public function getSiteLinkLookup() {
if ( $this-siteLinkTable === null ) {
-   $this-siteLinkTable = $this-newSiteLinkTable();
+   $this-siteLinkTable = new SiteLinkTable( 
'wb_items_per_site', true, $this-repoWiki );
}
 
return $this-siteLinkTable;
-   }
-
-   /**
-* @return SiteLinkLookup
-*/
-   private function newSiteLinkTable() {
-   return new SiteLinkTable( 'wb_items_per_site', true, 
$this-repoWiki );
}
 
/**
@@ -267,9 +260,9 @@
 */
public function getEntityLookup() {
$revisionLookup = $this-getEntityRevisionLookup();
-   $lookup = new RevisionBasedEntityLookup( $revisionLookup );
-   $lookup = new RedirectResolvingEntityLookup( $lookup );
-   return $lookup;
+   $revisionBasedLookup = new RevisionBasedEntityLookup( 
$revisionLookup );
+   $resolvingLookup = new RedirectResolvingEntityLookup( 
$revisionBasedLookup );
+   return $resolvingLookup;
}
 
/**
@@ -292,28 +285,28 @@
// NOTE: Keep cache key in sync with 
SqlStore::newEntityRevisionLookup on the Repo
$cacheKeyPrefix = $this-cacheKeyPrefix . 
':WikiPageEntityRevisionLookup';
 
-   $lookup = new WikiPageEntityRevisionLookup(
+   $rawLookup = new WikiPageEntityRevisionLookup(
$this-contentCodec,
$this-entityIdParser,
$this-repoWiki
);
 
// Lower caching layer using persistent cache (e.g. memcached).
-   // We need to verify the revision ID against the database to 
avoid stale data.
-   $lookup = new CachingEntityRevisionLookup(
-   $lookup,
+   $persistentCachingLookup = new CachingEntityRevisionLookup(
+   $rawLookup,