WMDE-leszek has uploaded a new change for review. https://gerrit.wikimedia.org/r/318119
Change subject: Use Database instead of DatabaseBase ...................................................................... Use Database instead of DatabaseBase Change-Id: I0ca364d170988159650ecae6c5b91fe1828e2811 --- M client/includes/Specials/SpecialUnconnectedPages.php M client/includes/Store/Sql/BulkSubscriptionUpdater.php M client/includes/Store/Sql/ConsistentReadConnectionManager.php M client/includes/Usage/Sql/EntityUsageTable.php M client/includes/Usage/Sql/EntityUsageTableBuilder.php M client/includes/Usage/Sql/SqlSubscriptionManager.php M client/includes/Usage/Sql/SqlUsageTracker.php M client/tests/phpunit/includes/Store/Sql/PagePropsEntityIdLookupTest.php M client/tests/phpunit/includes/Usage/Sql/EntityUsageTableTest.php M lib/includes/Store/Sql/SiteLinkTable.php M lib/includes/Store/Sql/TermSqlIndex.php M lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php M repo/includes/Store/SiteLinkConflictLookup.php M repo/includes/Store/Sql/ChangesSubscriptionTableBuilder.php M repo/includes/Store/Sql/DatabaseSchemaUpdater.php M repo/includes/Store/Sql/EntityPerPageTable.php M repo/includes/Store/Sql/SqlChangeDispatchCoordinator.php M repo/includes/Store/Sql/SqlIdGenerator.php M repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php M repo/includes/Store/Sql/SqlSubscriptionLookup.php M repo/includes/Store/Sql/TermSearchKeyBuilder.php M repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php 22 files changed, 100 insertions(+), 100 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/19/318119/1 diff --git a/client/includes/Specials/SpecialUnconnectedPages.php b/client/includes/Specials/SpecialUnconnectedPages.php index bab1522..26f961e 100644 --- a/client/includes/Specials/SpecialUnconnectedPages.php +++ b/client/includes/Specials/SpecialUnconnectedPages.php @@ -2,7 +2,7 @@ namespace Wikibase\Client\Specials; -use DatabaseBase; +use Database; use FakeResultWrapper; use Html; use Linker; @@ -95,13 +95,13 @@ * * @since 0.4 * - * @param DatabaseBase $dbr + * @param Database $dbr * @param Title|null $title * @param NamespaceChecker|null $checker * * @return string[] */ - public function buildConditionals( DatabaseBase $dbr, Title $title = null, NamespaceChecker $checker = null ) { + public function buildConditionals( Database $dbr, Title $title = null, NamespaceChecker $checker = null ) { $conds = array(); if ( $checker === null ) { diff --git a/client/includes/Store/Sql/BulkSubscriptionUpdater.php b/client/includes/Store/Sql/BulkSubscriptionUpdater.php index a7d7eba..c67f633 100644 --- a/client/includes/Store/Sql/BulkSubscriptionUpdater.php +++ b/client/includes/Store/Sql/BulkSubscriptionUpdater.php @@ -212,7 +212,7 @@ } /** - * Returns a list of rows for insertion, using DatabaseBase's multi-row insert mechanism. + * Returns a list of rows for insertion, using Database's multi-row insert mechanism. * Each row is represented as array( $entityId, $subscriber ). * * @param string[] $entities entity id strings diff --git a/client/includes/Store/Sql/ConsistentReadConnectionManager.php b/client/includes/Store/Sql/ConsistentReadConnectionManager.php index 2a951a1..0458980 100644 --- a/client/includes/Store/Sql/ConsistentReadConnectionManager.php +++ b/client/includes/Store/Sql/ConsistentReadConnectionManager.php @@ -2,7 +2,7 @@ namespace Wikibase\Client\Store\Sql; -use DatabaseBase; +use Database; use IDatabase; use InvalidArgumentException; use LoadBalancer; @@ -77,7 +77,7 @@ * ConsistentReadConnectionManager instance, this method will return a connection to the master database, * to avoid inconsistencies. * - * @return DatabaseBase + * @return Database */ public function getReadConnection() { $dbIndex = $this->forceMaster ? DB_MASTER : DB_SLAVE; @@ -88,14 +88,14 @@ * Returns a connection to the master DB, for updating. The connection should later be released * by calling releaseConnection(). * - * @return DatabaseBase + * @return Database */ public function getWriteConnection() { return $this->loadBalancer->getConnection( DB_MASTER, array(), $this->dbName ); } /** - * @param DatabaseBase $db + * @param Database $db */ public function releaseConnection( IDatabase $db ) { $this->loadBalancer->reuseConnection( $db ); @@ -110,7 +110,7 @@ * * @param string $fname * - * @return DatabaseBase + * @return Database */ public function beginAtomicSection( $fname ) { // Once we have written to master, do not read from slave. @@ -122,7 +122,7 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param string $fname */ public function commitAtomicSection( IDatabase $db, $fname ) { @@ -131,7 +131,7 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param string $fname */ public function rollbackAtomicSection( IDatabase $db, $fname ) { diff --git a/client/includes/Usage/Sql/EntityUsageTable.php b/client/includes/Usage/Sql/EntityUsageTable.php index 5daa3df..69e9bcc 100644 --- a/client/includes/Usage/Sql/EntityUsageTable.php +++ b/client/includes/Usage/Sql/EntityUsageTable.php @@ -3,7 +3,7 @@ namespace Wikibase\Client\Usage\Sql; use ArrayIterator; -use DatabaseBase; +use Database; use DBUnexpectedError; use InvalidArgumentException; use MWException; @@ -32,7 +32,7 @@ private $idParser; /** - * @var DatabaseBase + * @var Database */ private $connection; @@ -48,7 +48,7 @@ /** * @param EntityIdParser $idParser - * @param DatabaseBase $connection + * @param Database $connection * @param int $batchSize defaults to 100 * @param string|null $tableName defaults to wbc_entity_usage * @@ -56,7 +56,7 @@ */ public function __construct( EntityIdParser $idParser, - DatabaseBase $connection, + Database $connection, $batchSize = 100, $tableName = null ) { diff --git a/client/includes/Usage/Sql/EntityUsageTableBuilder.php b/client/includes/Usage/Sql/EntityUsageTableBuilder.php index 811e886..c53fc58 100644 --- a/client/includes/Usage/Sql/EntityUsageTableBuilder.php +++ b/client/includes/Usage/Sql/EntityUsageTableBuilder.php @@ -2,7 +2,7 @@ namespace Wikibase\Client\Usage\Sql; -use DatabaseBase; +use Database; use Exception; use InvalidArgumentException; use LoadBalancer; @@ -146,12 +146,12 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param EntityId[] $entityPerPage * * @return int The number of rows inserted. */ - private function insertUsageBatch( DatabaseBase $db, array $entityPerPage ) { + private function insertUsageBatch( Database $db, array $entityPerPage ) { $db->startAtomic( __METHOD__ ); $c = 0; @@ -177,12 +177,12 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param int $fromPageId * * @return EntityId[] An associative array mapping page IDs to Entity IDs. */ - private function getUsageBatch( DatabaseBase $db, $fromPageId = 0 ) { + private function getUsageBatch( Database $db, $fromPageId = 0 ) { $res = $db->select( 'page_props', array( 'pp_page', 'pp_value' ), diff --git a/client/includes/Usage/Sql/SqlSubscriptionManager.php b/client/includes/Usage/Sql/SqlSubscriptionManager.php index af2fffc..0f97f4a 100644 --- a/client/includes/Usage/Sql/SqlSubscriptionManager.php +++ b/client/includes/Usage/Sql/SqlSubscriptionManager.php @@ -2,7 +2,7 @@ namespace Wikibase\Client\Usage\Sql; -use DatabaseBase; +use Database; use DBError; use Exception; use InvalidArgumentException; @@ -117,13 +117,13 @@ /** * For a set of potential subscriptions, returns the existing subscriptions. * - * @param DatabaseBase $db + * @param Database $db * @param string $subscriber * @param string[] $subscriptions * * @return string[] Entity ID strings from $subscriptions which $subscriber is already subscribed to. */ - private function querySubscriptions( DatabaseBase $db, $subscriber, array $subscriptions ) { + private function querySubscriptions( Database $db, $subscriber, array $subscriptions ) { if ( $subscriptions ) { $subscriptions = $db->selectFieldValues( 'wb_changes_subscription', @@ -142,11 +142,11 @@ /** * Inserts a set of subscriptions. * - * @param DatabaseBase $db + * @param Database $db * @param string $subscriber * @param string[] $subscriptions */ - private function insertSubscriptions( DatabaseBase $db, $subscriber, array $subscriptions ) { + private function insertSubscriptions( Database $db, $subscriber, array $subscriptions ) { $rows = $this->makeSubscriptionRows( $subscriber, $subscriptions ); $db->insert( @@ -160,11 +160,11 @@ /** * Inserts a set of subscriptions. * - * @param DatabaseBase $db + * @param Database $db * @param string $subscriber * @param string[] $subscriptions */ - private function deleteSubscriptions( DatabaseBase $db, $subscriber, array $subscriptions ) { + private function deleteSubscriptions( Database $db, $subscriber, array $subscriptions ) { if ( $subscriptions ) { $db->delete( 'wb_changes_subscription', @@ -178,7 +178,7 @@ } /** - * Returns a list of rows for insertion, using DatabaseBase's multi-row insert mechanism. + * Returns a list of rows for insertion, using Database's multi-row insert mechanism. * Each row is represented as array( $subscriber, $entityId ). * * @param string $subscriber diff --git a/client/includes/Usage/Sql/SqlUsageTracker.php b/client/includes/Usage/Sql/SqlUsageTracker.php index 9912b8e..0dd9521 100644 --- a/client/includes/Usage/Sql/SqlUsageTracker.php +++ b/client/includes/Usage/Sql/SqlUsageTracker.php @@ -3,7 +3,7 @@ namespace Wikibase\Client\Usage\Sql; use ArrayIterator; -use DatabaseBase; +use Database; use DBError; use Exception; use InvalidArgumentException; @@ -49,11 +49,11 @@ } /** - * @param DatabaseBase $db + * @param Database $db * * @return EntityUsageTable */ - private function newUsageTable( DatabaseBase $db ) { + private function newUsageTable( Database $db ) { return new EntityUsageTable( $this->idParser, $db, $this->batchSize ); } diff --git a/client/tests/phpunit/includes/Store/Sql/PagePropsEntityIdLookupTest.php b/client/tests/phpunit/includes/Store/Sql/PagePropsEntityIdLookupTest.php index 6587ac7..49034e8 100644 --- a/client/tests/phpunit/includes/Store/Sql/PagePropsEntityIdLookupTest.php +++ b/client/tests/phpunit/includes/Store/Sql/PagePropsEntityIdLookupTest.php @@ -2,7 +2,7 @@ namespace Wikibase\Test; -use DatabaseBase; +use Database; use Title; use Wikibase\Client\Store\Sql\PagePropsEntityIdLookup; use Wikibase\DataModel\Entity\EntityId; @@ -34,7 +34,7 @@ return $title; } - private function insertPageProps( DatabaseBase $db, $pageId, EntityId $entityId ) { + private function insertPageProps( Database $db, $pageId, EntityId $entityId ) { $db->insert( 'page_props', array( diff --git a/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableTest.php b/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableTest.php index cfc8450..156f771 100644 --- a/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableTest.php +++ b/client/tests/phpunit/includes/Usage/Sql/EntityUsageTableTest.php @@ -2,7 +2,7 @@ namespace Wikibase\Client\Tests\Usage\Sql; -use DatabaseBase; +use Database; use InvalidArgumentException; use Wikibase\Client\Usage\EntityUsage; use Wikibase\Client\Usage\PageEntityUsages; @@ -342,12 +342,12 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param array $conditions * * @return bool */ - private function rowExists( DatabaseBase $db, array $conditions ) { + private function rowExists( Database $db, array $conditions ) { $count = $db->selectRowCount( EntityUsageTable::DEFAULT_TABLE_NAME, '*', $conditions ); return $count > 0; } diff --git a/lib/includes/Store/Sql/SiteLinkTable.php b/lib/includes/Store/Sql/SiteLinkTable.php index 84d68e2..7d724cf 100644 --- a/lib/includes/Store/Sql/SiteLinkTable.php +++ b/lib/includes/Store/Sql/SiteLinkTable.php @@ -2,7 +2,7 @@ namespace Wikibase\Lib\Store; -use DatabaseBase; +use Database; use DBAccessBase; use MWException; use Wikibase\DataModel\Entity\Item; @@ -127,11 +127,11 @@ /** * @param Item $item * @param SiteLink[] $links - * @param DatabaseBase $dbw + * @param Database $dbw * * @return bool Success indicator */ - private function insertLinks( Item $item, array $links, DatabaseBase $dbw ) { + private function insertLinks( Item $item, array $links, Database $dbw ) { wfDebugLog( __CLASS__, __FUNCTION__ . ': inserting links for ' . $item->getId()->getSerialization() ); $insert = array(); @@ -156,11 +156,11 @@ /** * @param Item $item * @param SiteLink[] $links - * @param DatabaseBase $dbw + * @param Database $dbw * * @return bool Success indicator */ - private function deleteLinks( Item $item, array $links, DatabaseBase $dbw ) { + private function deleteLinks( Item $item, array $links, Database $dbw ) { wfDebugLog( __CLASS__, __FUNCTION__ . ': deleting links for ' . $item->getId()->getSerialization() ); $siteIds = array(); diff --git a/lib/includes/Store/Sql/TermSqlIndex.php b/lib/includes/Store/Sql/TermSqlIndex.php index b8e8ce5..42c6a25 100644 --- a/lib/includes/Store/Sql/TermSqlIndex.php +++ b/lib/includes/Store/Sql/TermSqlIndex.php @@ -2,7 +2,7 @@ namespace Wikibase; -use DatabaseBase; +use Database; use DBAccessBase; use InvalidArgumentException; use MWException; @@ -134,11 +134,11 @@ /** * @param EntityDocument $entity * @param TermIndexEntry[] $terms - * @param DatabaseBase $dbw + * @param Database $dbw * * @return bool Success indicator */ - private function insertTerms( EntityDocument $entity, array $terms, DatabaseBase $dbw ) { + private function insertTerms( EntityDocument $entity, array $terms, Database $dbw ) { $entityIdentifiers = array( // FIXME: this will fail for IDs that do not have a numeric form 'term_entity_id' => $entity->getId()->getNumericId(), @@ -265,11 +265,11 @@ /** * @param EntityId $entityId * @param TermIndexEntry[] $terms - * @param DatabaseBase $dbw + * @param Database $dbw * * @return bool Success indicator */ - private function deleteTerms( EntityId $entityId, array $terms, DatabaseBase $dbw ) { + private function deleteTerms( EntityId $entityId, array $terms, Database $dbw ) { //TODO: Make getTermsOfEntity() collect term_row_id values, so we can use them here. // That would allow us to do the deletion in a single query, based on a set of ids. @@ -490,7 +490,7 @@ * * @since 0.1 * - * @return DatabaseBase + * @return Database */ public function getReadDb() { return $this->getConnection( DB_SLAVE ); @@ -501,7 +501,7 @@ * * @since 0.4 * - * @return DatabaseBase + * @return Database */ public function getWriteDb() { return $this->getConnection( DB_MASTER ); @@ -653,7 +653,7 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param TermIndexEntry[] $terms * @param string|string[]|null $termType * @param string|string[]|null $entityType @@ -662,7 +662,7 @@ * @return string[] */ private function termsToConditions( - DatabaseBase $db, + Database $db, array $terms, $termType = null, $entityType = null, @@ -679,7 +679,7 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param TermIndexEntry $term * @param string|string[]|null $termType * @param string|string[]|null $entityType @@ -688,7 +688,7 @@ * @return array */ private function termMatchConditions( - DatabaseBase $db, + Database $db, TermIndexEntry $term, $termType = null, $entityType = null, diff --git a/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php b/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php index 55ef205..c4e3f86 100644 --- a/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php +++ b/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php @@ -2,7 +2,7 @@ namespace Wikibase\Lib\Store\Sql; -use DatabaseBase; +use Database; use DBAccessBase; use DBQueryError; use ResultWrapper; @@ -227,11 +227,11 @@ /** * @param EntityId[] $entityIds - * @param DatabaseBase $db + * @param Database $db * * @return string */ - private function getWhere( array $entityIds, DatabaseBase $db ) { + private function getWhere( array $entityIds, Database $db ) { $where = []; foreach ( $entityIds as $entityId ) { diff --git a/repo/includes/Store/SiteLinkConflictLookup.php b/repo/includes/Store/SiteLinkConflictLookup.php index 4e88664..6980a92 100644 --- a/repo/includes/Store/SiteLinkConflictLookup.php +++ b/repo/includes/Store/SiteLinkConflictLookup.php @@ -2,7 +2,7 @@ namespace Wikibase\Repo\Store; -use DatabaseBase; +use Database; use Wikibase\DataModel\Entity\Item; /** @@ -27,7 +27,7 @@ * @since 0.1 * * @param Item $item - * @param DatabaseBase|null $db The database object to use (optional). + * @param Database|null $db The database object to use (optional). * If conflict checking is performed as part of a save operation, * this should be used to provide the master DB connection that will * also be used for saving. This will preserve transactional integrity @@ -35,6 +35,6 @@ * * @return array[] */ - public function getConflictsForItem( Item $item, DatabaseBase $db = null ); + public function getConflictsForItem( Item $item, Database $db = null ); } diff --git a/repo/includes/Store/Sql/ChangesSubscriptionTableBuilder.php b/repo/includes/Store/Sql/ChangesSubscriptionTableBuilder.php index 6f9dce2..f7ecd65 100644 --- a/repo/includes/Store/Sql/ChangesSubscriptionTableBuilder.php +++ b/repo/includes/Store/Sql/ChangesSubscriptionTableBuilder.php @@ -2,7 +2,7 @@ namespace Wikibase\Repo\Store\Sql; -use DatabaseBase; +use Database; use InvalidArgumentException; use LoadBalancer; use ResultWrapper; @@ -139,12 +139,12 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param array[] $subscriptionsPerItem * * @return int The number of rows inserted. */ - private function insertSubscriptionBatch( DatabaseBase $db, array $subscriptionsPerItem ) { + private function insertSubscriptionBatch( Database $db, array $subscriptionsPerItem ) { $db->startAtomic( __METHOD__ ); $c = 0; @@ -173,12 +173,12 @@ } /** - * @param DatabaseBase $db + * @param Database $db * @param array &$continuation * * @return array[] An associative array mapping item IDs to lists of site IDs. */ - private function getSubscriptionsPerItemBatch( DatabaseBase $db, &$continuation = array() ) { + private function getSubscriptionsPerItemBatch( Database $db, &$continuation = array() ) { if ( empty( $continuation ) ) { $continuationCondition = '1'; } else { @@ -240,7 +240,7 @@ } /** - * Returns a list of rows for insertion, using DatabaseBase's multi-row insert mechanism. + * Returns a list of rows for insertion, using Database's multi-row insert mechanism. * Each row is represented as array( $itemId, $subscriber ). * * @param string $itemId diff --git a/repo/includes/Store/Sql/DatabaseSchemaUpdater.php b/repo/includes/Store/Sql/DatabaseSchemaUpdater.php index b53995a..854d0a9 100644 --- a/repo/includes/Store/Sql/DatabaseSchemaUpdater.php +++ b/repo/includes/Store/Sql/DatabaseSchemaUpdater.php @@ -2,7 +2,7 @@ namespace Wikibase\Repo\Store\Sql; -use DatabaseBase; +use Database; use DatabaseUpdater; use HashBagOStuff; use MWException; @@ -127,9 +127,9 @@ /** * @param DatabaseUpdater $updater - * @param DatabaseBase $db + * @param Database $db */ - private function updateItemsPerSiteTable( DatabaseUpdater $updater, DatabaseBase $db ) { + private function updateItemsPerSiteTable( DatabaseUpdater $updater, Database $db ) { // Make wb_items_per_site.ips_site_page VARCHAR(310) - T99459 // NOTE: this update doesn't work on SQLite, but it's not needed there anyway. if ( $db->getType() !== 'sqlite' ) { @@ -143,9 +143,9 @@ /** * @param DatabaseUpdater $updater - * @param DatabaseBase $db + * @param Database $db */ - private function updateChangesTable( DatabaseUpdater $updater, DatabaseBase $db ) { + private function updateChangesTable( DatabaseUpdater $updater, Database $db ) { // Make wb_changes.change_info MEDIUMBLOB - T108246 // NOTE: this update doesn't work on SQLite, but it's not needed there anyway. if ( $db->getType() !== 'sqlite' ) { @@ -244,7 +244,7 @@ * falling back to the plain ".sql" extension if no specific script is found. * * @param string $name the script's name, without file extension - * @param string $type the database type, as returned by DatabaseBase::getType() + * @param string $type the database type, as returned by Database::getType() * * @return string The path to the script file * @throws MWException If the script was not found in any script directory @@ -280,9 +280,9 @@ * Applies updates to the wb_entity_per_page table. * * @param DatabaseUpdater $updater - * @param DatabaseBase $db + * @param Database $db */ - private function updateEntityPerPageTable( DatabaseUpdater $updater, DatabaseBase $db ) { + private function updateEntityPerPageTable( DatabaseUpdater $updater, Database $db ) { // Update from 0.1. or 0.2. if ( !$db->tableExists( 'wb_entity_per_page' ) ) { $updater->addExtensionTable( @@ -304,9 +304,9 @@ * Applies updates to the wb_terms table. * * @param DatabaseUpdater $updater - * @param DatabaseBase $db + * @param Database $db */ - private function updateTermsTable( DatabaseUpdater $updater, DatabaseBase $db ) { + private function updateTermsTable( DatabaseUpdater $updater, Database $db ) { // ---- Update from 0.1 or 0.2. ---- if ( !$db->fieldExists( 'wb_terms', 'term_search_key' ) ) { $updater->addExtensionField( diff --git a/repo/includes/Store/Sql/EntityPerPageTable.php b/repo/includes/Store/Sql/EntityPerPageTable.php index 4eecffc..6bfd0aa 100644 --- a/repo/includes/Store/Sql/EntityPerPageTable.php +++ b/repo/includes/Store/Sql/EntityPerPageTable.php @@ -165,7 +165,7 @@ /** * Returns a list of unique indexes, each index being described by a list of fields. - * This is intended for use with DatabaseBase::replace(). + * This is intended for use with Database::replace(). * * @return array[] */ diff --git a/repo/includes/Store/Sql/SqlChangeDispatchCoordinator.php b/repo/includes/Store/Sql/SqlChangeDispatchCoordinator.php index 9c33fd8..b4eb7a7 100644 --- a/repo/includes/Store/Sql/SqlChangeDispatchCoordinator.php +++ b/repo/includes/Store/Sql/SqlChangeDispatchCoordinator.php @@ -2,7 +2,7 @@ namespace Wikibase\Store\Sql; -use DatabaseBase; +use Database; use DBUnexpectedError; use Exception; use LoadBalancer; @@ -217,16 +217,16 @@ } /** - * @return DatabaseBase A connection to the repo's master database + * @return Database A connection to the repo's master database */ private function getRepoMaster() { return $this->getRepoLB()->getConnection( DB_MASTER, array(), $this->repoDB ); } /** - * @param DatabaseBase $db The repo database connection to release for re-use. + * @param Database $db The repo database connection to release for re-use. */ - private function releaseRepoMaster( DatabaseBase $db ) { + private function releaseRepoMaster( Database $db ) { $this->getRepoLB()->reuseConnection( $db ); } @@ -543,12 +543,12 @@ /** * Tries to acquire a global lock on the given client wiki. * - * @param DatabaseBase $db The database connection to work on. + * @param Database $db The database connection to work on. * @param string $lock The name of the lock to release. * * @return bool whether the lock was engaged successfully. */ - private function engageClientLock( DatabaseBase $db, $lock ) { + private function engageClientLock( Database $db, $lock ) { if ( isset( $this->engageClientLockOverride ) ) { return call_user_func( $this->engageClientLockOverride, $db, $lock ); } @@ -559,12 +559,12 @@ /** * Releases the given global lock on the given client wiki. * - * @param DatabaseBase $db The database connection to work on. + * @param Database $db The database connection to work on. * @param string $lock The name of the lock to release. * * @return bool whether the lock was released successfully. */ - private function releaseClientLock( DatabaseBase $db, $lock ) { + private function releaseClientLock( Database $db, $lock ) { if ( isset( $this->releaseClientLockOverride ) ) { return call_user_func( $this->releaseClientLockOverride, $db, $lock ); } @@ -575,12 +575,12 @@ /** * Checks the given global lock on the given client wiki. * - * @param DatabaseBase $db The database connection to work on. + * @param Database $db The database connection to work on. * @param string $lock The name of the lock to check. * * @return bool true if the given lock is currently held by another process, false otherwise. */ - private function isClientLockUsed( DatabaseBase $db, $lock ) { + private function isClientLockUsed( Database $db, $lock ) { if ( isset( $this->isClientLockUsedOverride ) ) { return call_user_func( $this->isClientLockUsedOverride, $db, $lock ); } diff --git a/repo/includes/Store/Sql/SqlIdGenerator.php b/repo/includes/Store/Sql/SqlIdGenerator.php index c86cad1..06d6b93 100644 --- a/repo/includes/Store/Sql/SqlIdGenerator.php +++ b/repo/includes/Store/Sql/SqlIdGenerator.php @@ -2,7 +2,7 @@ namespace Wikibase; -use DatabaseBase; +use Database; use LoadBalancer; use MWException; @@ -54,14 +54,14 @@ /** * Generates and returns a new ID. * - * @param DatabaseBase $database + * @param Database $database * @param string $type * @param bool $retry Retry once in case of e.g. race conditions. Defaults to true. * * @throws MWException * @return int */ - private function generateNewId( DatabaseBase $database, $type, $retry = true ) { + private function generateNewId( Database $database, $type, $retry = true ) { $database->startAtomic( __METHOD__ ); $currentId = $database->selectRow( diff --git a/repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php b/repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php index 53505ac..78a213c 100644 --- a/repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php +++ b/repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php @@ -2,7 +2,7 @@ namespace Wikibase\Repo\Store\Sql; -use DatabaseBase; +use Database; use DBAccessBase; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\SiteLink; @@ -22,11 +22,11 @@ * @see SiteLinkConflictLookup::getConflictsForItem * * @param Item $item - * @param DatabaseBase|null $db + * @param Database|null $db * * @return array[] */ - public function getConflictsForItem( Item $item, DatabaseBase $db = null ) { + public function getConflictsForItem( Item $item, Database $db = null ) { $siteLinks = $item->getSiteLinkList(); if ( $siteLinks->isEmpty() ) { diff --git a/repo/includes/Store/Sql/SqlSubscriptionLookup.php b/repo/includes/Store/Sql/SqlSubscriptionLookup.php index bc5b38d..25729ad 100644 --- a/repo/includes/Store/Sql/SqlSubscriptionLookup.php +++ b/repo/includes/Store/Sql/SqlSubscriptionLookup.php @@ -2,7 +2,7 @@ namespace Wikibase\Store\Sql; -use DatabaseBase; +use Database; use LoadBalancer; use Wikibase\DataModel\Entity\EntityId; use Wikibase\Store\SubscriptionLookup; @@ -88,13 +88,13 @@ /** * For a set of potential subscriptions, returns the existing subscriptions. * - * @param DatabaseBase $db + * @param Database $db * @param string $subscriber * @param string[]|null $idsToCheck Id strings to check * * @return string[] Entity ID strings from $subscriptions which $subscriber is subscribed to. */ - private function querySubscriptions( DatabaseBase $db, $subscriber, array $idsToCheck = null ) { + private function querySubscriptions( Database $db, $subscriber, array $idsToCheck = null ) { $where = array( 'cs_subscriber_id' => $subscriber, ); diff --git a/repo/includes/Store/Sql/TermSearchKeyBuilder.php b/repo/includes/Store/Sql/TermSearchKeyBuilder.php index 371d1e9..dca3d68 100644 --- a/repo/includes/Store/Sql/TermSearchKeyBuilder.php +++ b/repo/includes/Store/Sql/TermSearchKeyBuilder.php @@ -2,7 +2,7 @@ namespace Wikibase; -use DatabaseBase; +use Database; use Wikibase\Lib\Reporting\MessageReporter; use MediaWiki\MediaWikiServices; @@ -167,13 +167,13 @@ * * @see TermSqlIndex::getSearchKey * - * @param DatabaseBase $dbw the database connection to use + * @param Database $dbw the database connection to use * @param int $rowId the row to update * @param string $text the term's text * * @return string|bool the search key, or false if no search key could be calculated. */ - private function updateSearchKey( DatabaseBase $dbw, $rowId, $text ) { + private function updateSearchKey( Database $dbw, $rowId, $text ) { $key = $this->table->getSearchKey( $text ); if ( $key === '' ) { diff --git a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php index a481e59..83095d8 100644 --- a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php +++ b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php @@ -2,7 +2,7 @@ namespace Wikibase\Repo\Tests\Store\Sql; -use DatabaseBase; +use Database; use FakeResultWrapper; use MediaWikiTestCase; use Wikibase\DataModel\Entity\Item; @@ -101,8 +101,8 @@ /** * Gets a "lagged" database connection: We always leave out the first row on select. */ - private function getLaggedDatabase( DatabaseBase $realDB, $selectCount, $selectRowCount ) { - $db = $this->getMockBuilder( DatabaseBase::class ) + private function getLaggedDatabase( Database $realDB, $selectCount, $selectRowCount ) { + $db = $this->getMockBuilder( Database::class ) ->disableOriginalConstructor() ->setMethods( array( 'select', 'selectRow' ) ) ->setProxyTarget( $realDB ) -- To view, visit https://gerrit.wikimedia.org/r/318119 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0ca364d170988159650ecae6c5b91fe1828e2811 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: WMDE-leszek <leszek.mani...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits