$id = $this->getArticleID();
if ( $id ) {
$fname = __METHOD__;
- $loadRestrictionsFromDb = function ( Database $dbr ) use ( $fname, $id ) {
+ $loadRestrictionsFromDb = function ( IDatabase $dbr ) use ( $fname, $id ) {
return iterator_to_array(
$dbr->select(
'page_restrictions',
* @param array $conditions WHERE conditions for use with Database::update
* @return array WHERE conditions for use with Database::update
*/
- protected function makeUpdateConditions( Database $db, array $conditions ) {
+ protected function makeUpdateConditions( IDatabase $db, array $conditions ) {
if ( $this->mTouched ) {
// CAS check: only update if the row wasn't changed sicne it was loaded.
$conditions['user_touched'] = $db->timestamp( $this->mTouched );
self::$useTemporaryTables = !$this->getCliArg( 'use-normal-tables' );
self::$reuseDB = $this->getCliArg( 'reuse-db' );
- $this->db = wfGetDB( DB_MASTER );
+ $lb = MediaWikiServices::getInstance()->getDBLoadBalancer();
+ $this->db = $lb->getConnection( DB_MASTER );
$this->checkDbIsSupported();
* @note this method only works when first called. Subsequent calls have no effect,
* even if using different parameters.
*
- * @param Database $db The database connection
+ * @param IMaintainableDatabase $db The database connection
* @param string $prefix The prefix to use for the new table set (aka schema).
*
* @throws MWException If the database table prefix is already $prefix
*/
- public static function setupTestDB( Database $db, $prefix ) {
+ public static function setupTestDB( IMaintainableDatabase $db, $prefix ) {
if ( self::$dbSetup ) {
return;
}
* @copyright © 2013 Wikimedia Foundation Inc.
*/
-use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
use Wikimedia\Rdbms\IMaintainableDatabase;
use Wikimedia\Rdbms\LBFactory;
$factory->destroy();
}
- private function quoteTable( Database $db, $table ) {
+ private function quoteTable( IDatabase $db, $table ) {
if ( $db->getType() === 'sqlite' ) {
return $table;
} else {