summaryrefslogtreecommitdiff
path: root/includes/filebackend/lockmanager
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2015-06-04 07:31:04 +0200
committerPierre Schmitz <pierre@archlinux.de>2015-06-04 07:58:39 +0200
commitf6d65e533c62f6deb21342d4901ece24497b433e (patch)
treef28adf0362d14bcd448f7b65a7aaf38650f923aa /includes/filebackend/lockmanager
parentc27b2e832fe25651ef2410fae85b41072aae7519 (diff)
Update to MediaWiki 1.25.1
Diffstat (limited to 'includes/filebackend/lockmanager')
-rw-r--r--includes/filebackend/lockmanager/DBLockManager.php4
-rw-r--r--includes/filebackend/lockmanager/LockManager.php10
-rw-r--r--includes/filebackend/lockmanager/LockManagerGroup.php16
-rw-r--r--includes/filebackend/lockmanager/MemcLockManager.php6
-rw-r--r--includes/filebackend/lockmanager/RedisLockManager.php2
5 files changed, 17 insertions, 21 deletions
diff --git a/includes/filebackend/lockmanager/DBLockManager.php b/includes/filebackend/lockmanager/DBLockManager.php
index 450ccc82..39a55635 100644
--- a/includes/filebackend/lockmanager/DBLockManager.php
+++ b/includes/filebackend/lockmanager/DBLockManager.php
@@ -52,7 +52,7 @@ abstract class DBLockManager extends QuorumLockManager {
/**
* Construct a new instance from configuration.
*
- * @param array $config Paramaters include:
+ * @param array $config Parameters include:
* - dbServers : Associative array of DB names to server configuration.
* Configuration is an associative array that includes:
* - host : DB server name
@@ -97,7 +97,7 @@ abstract class DBLockManager extends QuorumLockManager {
// connection timeouts. This is useless if each bucket has one peer.
try {
$this->statusCache = ObjectCache::newAccelerator( array() );
- } catch ( MWException $e ) {
+ } catch ( Exception $e ) {
trigger_error( __CLASS__ .
" using multiple DB peers without apc, xcache, or wincache." );
}
diff --git a/includes/filebackend/lockmanager/LockManager.php b/includes/filebackend/lockmanager/LockManager.php
index df8d2d4f..615ba77e 100644
--- a/includes/filebackend/lockmanager/LockManager.php
+++ b/includes/filebackend/lockmanager/LockManager.php
@@ -64,7 +64,7 @@ abstract class LockManager {
/**
* Construct a new instance from configuration
*
- * @param array $config Paramaters include:
+ * @param array $config Parameters include:
* - domain : Domain (usually wiki ID) that all resources are relative to [optional]
* - lockTTL : Age (in seconds) at which resource locks should expire.
* This only applies if locks are not tied to a connection/process.
@@ -72,9 +72,9 @@ abstract class LockManager {
public function __construct( array $config ) {
$this->domain = isset( $config['domain'] ) ? $config['domain'] : wfWikiID();
if ( isset( $config['lockTTL'] ) ) {
- $this->lockTTL = max( 1, $config['lockTTL'] );
+ $this->lockTTL = max( 5, $config['lockTTL'] );
} elseif ( PHP_SAPI === 'cli' ) {
- $this->lockTTL = 2 * 3600;
+ $this->lockTTL = 3600;
} else {
$met = ini_get( 'max_execution_time' ); // this is 0 in CLI mode
$this->lockTTL = max( 5 * 60, 2 * (int)$met );
@@ -102,7 +102,6 @@ abstract class LockManager {
* @since 1.22
*/
final public function lockByType( array $pathsByType, $timeout = 0 ) {
- wfProfileIn( __METHOD__ );
$status = Status::newGood();
$pathsByType = $this->normalizePathsByType( $pathsByType );
$msleep = array( 0, 50, 100, 300, 500 ); // retry backoff times
@@ -116,7 +115,6 @@ abstract class LockManager {
usleep( 1e3 * ( next( $msleep ) ?: 1000 ) ); // use 1 sec after enough times
$elapsed = microtime( true ) - $start;
} while ( $elapsed < $timeout && $elapsed >= 0 );
- wfProfileOut( __METHOD__ );
return $status;
}
@@ -140,10 +138,8 @@ abstract class LockManager {
* @since 1.22
*/
final public function unlockByType( array $pathsByType ) {
- wfProfileIn( __METHOD__ );
$pathsByType = $this->normalizePathsByType( $pathsByType );
$status = $this->doUnlockByType( $pathsByType );
- wfProfileOut( __METHOD__ );
return $status;
}
diff --git a/includes/filebackend/lockmanager/LockManagerGroup.php b/includes/filebackend/lockmanager/LockManagerGroup.php
index 19fc4fef..c72863ed 100644
--- a/includes/filebackend/lockmanager/LockManagerGroup.php
+++ b/includes/filebackend/lockmanager/LockManagerGroup.php
@@ -78,17 +78,17 @@ class LockManagerGroup {
* Register an array of file lock manager configurations
*
* @param array $configs
- * @throws MWException
+ * @throws Exception
*/
protected function register( array $configs ) {
foreach ( $configs as $config ) {
$config['domain'] = $this->domain;
if ( !isset( $config['name'] ) ) {
- throw new MWException( "Cannot register a lock manager with no name." );
+ throw new Exception( "Cannot register a lock manager with no name." );
}
$name = $config['name'];
if ( !isset( $config['class'] ) ) {
- throw new MWException( "Cannot register lock manager `{$name}` with no class." );
+ throw new Exception( "Cannot register lock manager `{$name}` with no class." );
}
$class = $config['class'];
unset( $config['class'] ); // lock manager won't need this
@@ -105,11 +105,11 @@ class LockManagerGroup {
*
* @param string $name
* @return LockManager
- * @throws MWException
+ * @throws Exception
*/
public function get( $name ) {
if ( !isset( $this->managers[$name] ) ) {
- throw new MWException( "No lock manager defined with the name `$name`." );
+ throw new Exception( "No lock manager defined with the name `$name`." );
}
// Lazy-load the actual lock manager instance
if ( !isset( $this->managers[$name]['instance'] ) ) {
@@ -126,11 +126,11 @@ class LockManagerGroup {
*
* @param string $name
* @return array
- * @throws MWException
+ * @throws Exception
*/
public function config( $name ) {
if ( !isset( $this->managers[$name] ) ) {
- throw new MWException( "No lock manager defined with the name `$name`." );
+ throw new Exception( "No lock manager defined with the name `$name`." );
}
$class = $this->managers[$name]['class'];
@@ -155,7 +155,7 @@ class LockManagerGroup {
* Throws an exception if no lock manager could be found.
*
* @return LockManager
- * @throws MWException
+ * @throws Exception
*/
public function getAny() {
return isset( $this->managers['default'] )
diff --git a/includes/filebackend/lockmanager/MemcLockManager.php b/includes/filebackend/lockmanager/MemcLockManager.php
index 9bb01c21..24d96e02 100644
--- a/includes/filebackend/lockmanager/MemcLockManager.php
+++ b/includes/filebackend/lockmanager/MemcLockManager.php
@@ -55,13 +55,13 @@ class MemcLockManager extends QuorumLockManager {
/**
* Construct a new instance from configuration.
*
- * @param array $config Paramaters include:
+ * @param array $config Parameters include:
* - lockServers : Associative array of server names to "<IP>:<port>" strings.
* - srvsByBucket : Array of 1-16 consecutive integer keys, starting from 0,
* each having an odd-numbered list of server names (peers) as values.
* - memcConfig : Configuration array for ObjectCache::newFromParams. [optional]
* If set, this must use one of the memcached classes.
- * @throws MWException
+ * @throws Exception
*/
public function __construct( array $config ) {
parent::__construct( $config );
@@ -80,7 +80,7 @@ class MemcLockManager extends QuorumLockManager {
if ( $cache instanceof MemcachedBagOStuff ) {
$this->bagOStuffs[$name] = $cache;
} else {
- throw new MWException(
+ throw new Exception(
'Only MemcachedBagOStuff classes are supported by MemcLockManager.' );
}
}
diff --git a/includes/filebackend/lockmanager/RedisLockManager.php b/includes/filebackend/lockmanager/RedisLockManager.php
index 90e05817..90e62e69 100644
--- a/includes/filebackend/lockmanager/RedisLockManager.php
+++ b/includes/filebackend/lockmanager/RedisLockManager.php
@@ -62,7 +62,7 @@ class RedisLockManager extends QuorumLockManager {
* - srvsByBucket : Array of 1-16 consecutive integer keys, starting from 0,
* each having an odd-numbered list of server names (peers) as values.
* - redisConfig : Configuration for RedisConnectionPool::__construct().
- * @throws MWException
+ * @throws Exception
*/
public function __construct( array $config ) {
parent::__construct( $config );