* @ingroup LockManager
*/
+use Wikimedia\Rdbms\Database;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\DBError;
+
/**
* Version of LockManager based on using named/row DB locks.
*
protected $lockExpiry; // integer number of seconds
protected $safeDelay; // integer number of seconds
-
- protected $session = 0; // random integer
/** @var IDatabase[] Map Database connections (DB name => Database) */
protected $conns = [];
* - user : DB user
* - password : DB user password
* - tablePrefix : DB table prefix
- * - flags : DB flags (see DatabaseBase)
+ * - flags : DB flags; bitfield of IDatabase::DBO_* constants
* - dbsByBucket : Array of 1-16 consecutive integer keys, starting from 0,
* each having an odd-numbered list of DB names (peers) as values.
* - lockExpiry : Lock timeout (seconds) for dropped connections. [optional]
$this->statusCache = isset( $config['srvCache'] )
? $config['srvCache']
: new HashBagOStuff();
-
- $random = [];
- for ( $i = 1; $i <= 5; ++$i ) {
- $random[] = mt_rand( 0, 0xFFFFFFF );
- }
- $this->session = substr( md5( implode( '-', $random ) ), 0, 31 );
}
/**
} elseif ( is_array( $this->dbServers[$lockDb] ) ) {
// Parameters to construct a new database connection
$config = $this->dbServers[$lockDb];
- $db = DatabaseBase::factory( $config['type'], $config );
+ $db = Database::factory( $config['type'], $config );
} else {
throw new UnexpectedValueException( "No server called '$lockDb'." );
}