/** @var string "AND" or "OR" */
protected $mode;
- /** @var DatabaseBase Read-DB slave */
+ /** @var IDatabase Read-DB slave */
protected $dbr;
/**
}
/**
- * Make an array to be used for calls to DatabaseBase::buildLike(), which
+ * Make an array to be used for calls to Database::buildLike(), which
* will match the specified string. There are several kinds of filter entry:
* *.domain.com - Produces http://com.domain.%, matches domain.com
* and www.domain.com
*
* @param string $filterEntry Domainparts
* @param string $protocol Protocol (default http://)
- * @return array Array to be passed to DatabaseBase::buildLike() or false on error
+ * @return array Array to be passed to Database::buildLike() or false on error
*/
public static function makeLikeArray( $filterEntry, $protocol = 'http://' ) {
$db = wfGetDB( DB_SLAVE );
/**
* Do the DB query to iterate through the objects.
- * @param IDatabase $db DatabaseBase object to use for the query
+ * @param IDatabase $db DB object to use for the query
*/
abstract public function doQuery( $db );
/**
* Constructor
- * @param bool|DatabaseBase $database
- * - Boolean: whether to use the master DB
- * - DatabaseBase: database connection to use
+ * @param bool|IDatabase $database
+ * - boolean: Whether to use the master DB
+ * - IDatabase: Database connection to use
*/
public function __construct( $database = false ) {
- if ( $database instanceof DatabaseBase ) {
+ if ( $database instanceof IDatabase ) {
$this->db = $database;
} else {
$this->db = wfGetDB( $database ? DB_MASTER : DB_SLAVE );
* for the original initStats, but without output.
*
* @param IDatabase|bool $database
- * - Boolean: whether to use the master DB
- * - DatabaseBase: database connection to use
+ * - boolean: Whether to use the master DB
+ * - IDatabase: Database connection to use
* @param array $options Array of options, may contain the following values
- * - activeUsers Boolean: whether to update the number of active users (default: false)
+ * - activeUsers boolean: Whether to update the number of active users (default: false)
*/
public static function doAllAndCommit( $database, array $options = array() ) {
$options += array( 'update' => false, 'activeUsers' => false );
*
* @param string $database
* @param bool $ignoreInvalidDB If true, don't check if $database is in $wgLocalDatabases
- * @return DatabaseBase|null If invalid selection
+ * @return IDatabase|null If invalid selection
*/
public static function getDB( $database, $ignoreInvalidDB = false ) {
global $wgDBname;
* Get a slave database connection for the specified cluster
*
* @param string $cluster Cluster name
- * @return DatabaseBase
+ * @return IDatabase
*/
function getSlave( $cluster ) {
global $wgDefaultExternalStore;
* Get a master database connection for the specified cluster
*
* @param string $cluster Cluster name
- * @return DatabaseBase
+ * @return IDatabase
*/
function getMaster( $cluster ) {
$wiki = isset( $this->params['wiki'] ) ? $this->params['wiki'] : false;
* Helper function for self::batchFetchBlobs for merging master/slave results
* @param array &$ret Current self::batchFetchBlobs return value
* @param array &$ids Map from blob_id to requested itemIDs
- * @param mixed $res DB result from DatabaseBase::select
+ * @param mixed $res DB result from Database::select
*/
private function mergeBatchResult( array &$ret, array &$ids, $res ) {
foreach ( $res as $row ) {
* @since 1.20
*/
class DBFileJournal extends FileJournal {
- /** @var DatabaseBase */
+ /** @var IDatabase */
protected $dbw;
protected $wiki = false; // string; wiki DB name
/**
* Get a master connection to the logging DB
*
- * @return DatabaseBase
+ * @return IDatabase
* @throws DBError
*/
protected function getMasterDB() {
* Get (or reuse) a connection to a lock DB
*
* @param string $lockDb
- * @return DatabaseBase
+ * @return IDatabase
* @throws DBError
*/
protected function getConnection( $lockDb ) {
* Do additional initialization for new lock DB connection
*
* @param string $lockDb
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @throws DBError
*/
- protected function initConnection( $lockDb, DatabaseBase $db ) {
+ protected function initConnection( $lockDb, IDatabase $db ) {
}
/**
/**
* @param string $lockDb
- * @param DatabaseBase $db
+ * @param IDatabase $db
*/
- protected function initConnection( $lockDb, DatabaseBase $db ) {
+ protected function initConnection( $lockDb, IDatabase $db ) {
# Let this transaction see lock rows from other transactions
$db->query( "SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;" );
}
}
/**
- * @return DatabaseBase
+ * @return IDatabase
*/
function getMasterDB() {
if ( !isset( $this->dbConn ) ) {
}
/**
- * @return DatabaseBase
+ * @return IDatabase
*/
function getSlaveDB() {
return $this->getMasterDB();
}
/**
- * @return DatabaseBase
+ * @return IDatabase
*/
function getMasterDB() {
return wfGetDB( DB_MASTER, array(), $this->wiki );
}
/**
- * @return DatabaseBase
+ * @return IDatabase
*/
function getSlaveDB() {
return wfGetDB( DB_SLAVE, array(), $this->wiki );
// Re-ping all masters with transactions. This throws DBError if some
// connection died while waiting on locks/slaves, triggering a rollback.
wfGetLBFactory()->forEachLB( function( LoadBalancer $lb ) use ( $fname ) {
- $lb->forEachOpenConnection( function( DatabaseBase $conn ) use ( $fname ) {
+ $lb->forEachOpenConnection( function( IDatabase $conn ) use ( $fname ) {
if ( $conn->writesOrCallbacksPending() ) {
$conn->query( "SELECT 1", $fname );
}
* Values in the arguments collection which are Closure instances will be
* expanded by invoking them with no arguments before passing the
* resulting value on to the constructor/callable. This can be used to
- * pass DatabaseBase instances or other live objects to the
+ * pass IDatabase instances or other live objects to the
* constructor/callable. This behavior can be suppressed by adding
* closure_expansion => false to the specification.
*
* Get a connection to the specified database
*
* @param int $serverIndex
- * @return DatabaseBase
+ * @return IDatabase
* @throws MWException
*/
protected function getDB( $serverIndex ) {
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @param string $exptime
* @return bool
*/
}
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @return string
*/
protected function getMaxDateTime( $db ) {
/**
* Get the Database object in use
*
- * @return DatabaseBase
+ * @return IDatabase
*/
public function getDatabase() {
return $this->mDb;
class BatchRowIterator implements RecursiveIterator {
/**
- * @var DatabaseBase $db The database to read from
+ * @var IDatabase $db The database to read from
*/
protected $db;
/**
* @var array $fetchColumns List of column names to select from the
- * table suitable for use with DatabaseBase::select()
+ * table suitable for use with IDatabase::select()
*/
protected $fetchColumns;
/**
* @param array $condition Query conditions suitable for use with
- * DatabaseBase::select
+ * IDatabase::select
*/
public function addConditions( array $conditions ) {
$this->conditions = array_merge( $this->conditions, $conditions );
/**
* @param array $condition Query join conditions suitable for use
- * with DatabaseBase::select
+ * with IDatabase::select
*/
public function addJoinConditions( array $conditions ) {
$this->joinConditions = array_merge( $this->joinConditions, $conditions );
/**
* @param array $columns List of column names to select from the
- * table suitable for use with DatabaseBase::select()
+ * table suitable for use with IDatabase::select()
*/
public function setFetchColumns( array $columns ) {
// If it's not the all column selector merge in the primary keys we need
*/
class BatchRowWriter {
/**
- * @var DatabaseBase $db The database to write to
+ * @var IDatabase $db The database to write to
*/
protected $db;