From: Aaron Schulz Date: Sat, 14 Jan 2012 03:16:18 +0000 (+0000) Subject: * Fixed bogus var in LSLockManager. X-Git-Tag: 1.31.0-rc.0~25278 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=d49324ec7d2897f8d0b387aa634c40a2ed17fe8f;p=lhc%2Fweb%2Fwiklou.git * Fixed bogus var in LSLockManager. * Made DBLockManager constructor a bit more convenient to use with just 'localDBMaster' in the db buckets. * Documentation tweaks. --- diff --git a/includes/filerepo/backend/SwiftFileBackend.php b/includes/filerepo/backend/SwiftFileBackend.php index a067d5f035..4140f89487 100644 --- a/includes/filerepo/backend/SwiftFileBackend.php +++ b/includes/filerepo/backend/SwiftFileBackend.php @@ -16,6 +16,7 @@ * All of the library classes must be registed in $wgAutoloadClasses. * * @ingroup FileBackend + * @since 1.19 */ class SwiftFileBackend extends FileBackend { /** @var CF_Authentication */ @@ -650,6 +651,7 @@ class SwiftFileBackend extends FileBackend { /** * SwiftFileBackend helper class to page through object listings. * Swift also has a listing limit of 10,000 objects for sanity. + * Do not use this class from places outside SwiftFileBackend. * * @ingroup FileBackend */ diff --git a/includes/filerepo/backend/lockmanager/DBLockManager.php b/includes/filerepo/backend/lockmanager/DBLockManager.php index 900a6396b9..045056ead6 100644 --- a/includes/filerepo/backend/lockmanager/DBLockManager.php +++ b/includes/filerepo/backend/lockmanager/DBLockManager.php @@ -55,7 +55,9 @@ class DBLockManager extends LockManager { * @param Array $config */ public function __construct( array $config ) { - $this->dbServers = $config['dbServers']; + $this->dbServers = isset( $config['dbServers'] ) + ? $config['dbServers'] + : array(); // likely just using 'localDBMaster' // Sanitize dbsByBucket config to prevent PHP errors $this->dbsByBucket = array_filter( $config['dbsByBucket'], 'is_array' ); $this->dbsByBucket = array_values( $this->dbsByBucket ); // consecutive diff --git a/includes/filerepo/backend/lockmanager/LSLockManager.php b/includes/filerepo/backend/lockmanager/LSLockManager.php index 58fb8f3f2d..8b59009619 100644 --- a/includes/filerepo/backend/lockmanager/LSLockManager.php +++ b/includes/filerepo/backend/lockmanager/LSLockManager.php @@ -278,7 +278,7 @@ class LSLockManager extends LockManager { */ protected function getBucketFromKey( $path ) { $prefix = substr( sha1( $path ), 0, 2 ); // first 2 hex chars (8 bits) - return intval( base_convert( $prefix, 16, 10 ) ) % count( $this->dbsByBucket ); + return intval( base_convert( $prefix, 16, 10 ) ) % count( $this->srvsByBucket ); } /**