Daniel Kinzler has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/399663 )
Change subject: Use IDatabase instead of DatabaseBase
......................................................................
Use IDatabase instead of DatabaseBase
Change-Id: Ibe9aa42a28c308dd04f41e6bd48fd97e20a27f65
---
M includes/BoardMover.php
M includes/Data/Storage/DbStorage.php
M includes/Data/Storage/RevisionStorage.php
M includes/DbFactory.php
M includes/Dump/Exporter.php
M includes/Import/Converter.php
M includes/Import/LiquidThreadsApi/ConversionStrategy.php
M includes/Import/LiquidThreadsApi/Source.php
M includes/Import/Postprocessor/LqtNotifications.php
M includes/Import/SourceStore/FlowRevisionsDb.php
M includes/Search/Iterators/AbstractIterator.php
M includes/Utils/NamespaceIterator.php
M includes/Utils/PagesWithPropertyIterator.php
M includes/WatchedTopicItems.php
M maintenance/FlowExternalStoreMoveCluster.php
M maintenance/FlowFixEditCount.php
M maintenance/FlowFixUserIp.php
M maintenance/FlowSetUserIp.php
M maintenance/FlowUpdateRecentChanges.php
M tests/phpunit/Import/ConverterTest.php
M tests/phpunit/Import/LiquidThreadsApi/ConversionStrategyTest.php
21 files changed, 54 insertions(+), 54 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/63/399663/1
diff --git a/includes/BoardMover.php b/includes/BoardMover.php
index 0f32d2b..e2c7346 100644
--- a/includes/BoardMover.php
+++ b/includes/BoardMover.php
@@ -2,7 +2,7 @@
namespace Flow;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Data\ManagerGroup;
use Flow\Exception\FlowException;
use Flow\Model\Header;
@@ -27,7 +27,7 @@
protected $nullEditUser;
/**
- * @var DatabaseBase|null
+ * @var IDatabase|null
*/
protected $dbw;
diff --git a/includes/Data/Storage/DbStorage.php
b/includes/Data/Storage/DbStorage.php
index 53f6c4c..9ea1dbe 100644
--- a/includes/Data/Storage/DbStorage.php
+++ b/includes/Data/Storage/DbStorage.php
@@ -69,7 +69,7 @@
* 2. Checks for unarmoured raw SQL and errors out if it exists.
* 3. Finds armoured raw SQL and expands it out.
*
- * @param array $data Query conditions for DatabaseBase::select
+ * @param array $data Query conditions for IDatabase::select
* @return array query conditions escaped for use
* @throws DataModelException
*/
diff --git a/includes/Data/Storage/RevisionStorage.php
b/includes/Data/Storage/RevisionStorage.php
index 7b24592..f1948f8 100644
--- a/includes/Data/Storage/RevisionStorage.php
+++ b/includes/Data/Storage/RevisionStorage.php
@@ -2,7 +2,7 @@
namespace Flow\Data\Storage;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use ExternalStore;
use Flow\Data\Utils\Merger;
use Flow\Data\Utils\ResultDuplicator;
@@ -341,7 +341,7 @@
);
}
- protected function buildCompositeInCondition( DatabaseBase $dbr, array
$queries ) {
+ protected function buildCompositeInCondition( IDatabase $dbr, array
$queries ) {
$keys = array_keys( reset( $queries ) );
$conditions = [];
if ( count( $keys ) === 1 ) {
diff --git a/includes/DbFactory.php b/includes/DbFactory.php
index 4f1fc6d..b13d7d7 100644
--- a/includes/DbFactory.php
+++ b/includes/DbFactory.php
@@ -71,7 +71,7 @@
*
* @param int $db index of the connection to get. DB_MASTER|DB_REPLICA.
* @param string|bool $wiki The wiki ID, or false for the current wiki
- * @return \DatabaseBase
+ * @return \IDatabase
*/
public function getWikiDB( $db, $wiki = false ) {
return wfGetDB( $this->forceMaster ? DB_MASTER : $db, [], $wiki
);
diff --git a/includes/Dump/Exporter.php b/includes/Dump/Exporter.php
index 354cdd1..03f0a66 100644
--- a/includes/Dump/Exporter.php
+++ b/includes/Dump/Exporter.php
@@ -3,7 +3,7 @@
namespace Flow\Dump;
use BatchRowIterator;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Exception;
use Flow\Collection\PostSummaryCollection;
use Flow\Container;
@@ -127,7 +127,7 @@
* @return BatchRowIterator
*/
public function getWorkflowIterator( array $pages = null, $startId =
null, $endId = null ) {
- /** @var DatabaseBase $dbr */
+ /** @var IDatabase $dbr */
$dbr = Container::get( 'db.factory' )->getDB( DB_REPLICA );
$iterator = new BatchRowIterator( $dbr, 'flow_workflow',
'workflow_id', 300 );
diff --git a/includes/Import/Converter.php b/includes/Import/Converter.php
index 512f975..0885277 100644
--- a/includes/Import/Converter.php
+++ b/includes/Import/Converter.php
@@ -2,7 +2,7 @@
namespace Flow\Import;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Exception\FlowException;
use MovePage;
use MWExceptionHandler;
@@ -31,7 +31,7 @@
*/
class Converter {
/**
- * @var DatabaseBase Master database of the current wiki. Required
+ * @var IDatabase Master database of the current wiki. Required
* to lookup past page moves.
*/
protected $dbw;
@@ -61,7 +61,7 @@
protected $strategy;
/**
- * @param DatabaseBase $dbw Master wiki database to read from
+ * @param IDatabase $dbw Master wiki database to read from
* @param Importer $importer
* @param LoggerInterface $logger
* @param User $user User for moves and edits related to the conversion
process
@@ -69,7 +69,7 @@
* @throws ImportException When $user does not have an Id
*/
public function __construct(
- DatabaseBase $dbw,
+ IDatabase $dbw,
Importer $importer,
LoggerInterface $logger,
User $user,
diff --git a/includes/Import/LiquidThreadsApi/ConversionStrategy.php
b/includes/Import/LiquidThreadsApi/ConversionStrategy.php
index a2310fa..715f0fd 100644
--- a/includes/Import/LiquidThreadsApi/ConversionStrategy.php
+++ b/includes/Import/LiquidThreadsApi/ConversionStrategy.php
@@ -2,7 +2,7 @@
namespace Flow\Import\LiquidThreadsApi;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Import\ArchiveNameHelper;
use Flow\Import\IConversionStrategy;
use Flow\Import\SourceStore\SourceStoreInterface as ImportSourceStore;
@@ -30,7 +30,7 @@
*/
class ConversionStrategy implements IConversionStrategy {
/**
- * @var DatabaseBase Master database for the current wiki
+ * @var IDatabase Master database for the current wiki
*/
protected $dbw;
@@ -60,7 +60,7 @@
protected $notificationController;
public function __construct(
- DatabaseBase $dbw,
+ IDatabase $dbw,
ImportSourceStore $sourceStore,
ApiBackend $api,
UrlGenerator $urlGenerator,
diff --git a/includes/Import/LiquidThreadsApi/Source.php
b/includes/Import/LiquidThreadsApi/Source.php
index 330d7c2..d94ce14 100644
--- a/includes/Import/LiquidThreadsApi/Source.php
+++ b/includes/Import/LiquidThreadsApi/Source.php
@@ -355,7 +355,7 @@
protected function isNotFoundError( $apiResponse ) {
// LQT has some bugs where not finding the requested item in
the database throws
// returns this exception.
- $expect = 'Exception Caught: DatabaseBase::makeList: empty
input for field thread_parent';
+ $expect = 'Exception Caught: IDatabase::makeList: empty input
for field thread_parent';
return false !== strpos( $apiResponse['error']['info'], $expect
);
}
}
diff --git a/includes/Import/Postprocessor/LqtNotifications.php
b/includes/Import/Postprocessor/LqtNotifications.php
index e57c87f..7be15f5 100644
--- a/includes/Import/Postprocessor/LqtNotifications.php
+++ b/includes/Import/Postprocessor/LqtNotifications.php
@@ -2,7 +2,7 @@
namespace Flow\Import\Postprocessor;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use BatchRowIterator;
use EchoCallbackIterator;
use EchoEvent;
@@ -29,7 +29,7 @@
protected $controller;
/**
- * @var DatabaseBase
+ * @var IDatabase
*/
protected $dbw;
@@ -38,7 +38,7 @@
*/
protected $postsImported = [];
- public function __construct( NotificationController $controller,
DatabaseBase $dbw ) {
+ public function __construct( NotificationController $controller,
IDatabase $dbw ) {
$this->controller = $controller;
$this->dbw = $dbw;
$this->overrideUsersToNotify();
diff --git a/includes/Import/SourceStore/FlowRevisionsDb.php
b/includes/Import/SourceStore/FlowRevisionsDb.php
index 4ca6c6b..d52e076 100644
--- a/includes/Import/SourceStore/FlowRevisionsDb.php
+++ b/includes/Import/SourceStore/FlowRevisionsDb.php
@@ -2,7 +2,7 @@
namespace Flow\Import\SourceStore;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use IP;
use Flow\Import\IImportHeader;
use Flow\Import\IImportObject;
@@ -29,14 +29,14 @@
*/
class FlowRevisionsDb implements SourceStoreInterface {
/**
- * @var DatabaseBase
+ * @var IDatabase
*/
protected $dbr;
/**
- * @param DatabaseBase $dbr
+ * @param IDatabase $dbr
*/
- public function __construct( DatabaseBase $dbr ) {
+ public function __construct( IDatabase $dbr ) {
$this->dbr = $dbr;
}
diff --git a/includes/Search/Iterators/AbstractIterator.php
b/includes/Search/Iterators/AbstractIterator.php
index c00bef8..b42a376 100644
--- a/includes/Search/Iterators/AbstractIterator.php
+++ b/includes/Search/Iterators/AbstractIterator.php
@@ -2,7 +2,7 @@
namespace Flow\Search\Iterators;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Container;
use Flow\Data\ManagerGroup;
use Flow\DbFactory;
@@ -14,7 +14,7 @@
abstract class AbstractIterator implements Iterator {
/**
- * @var DatabaseBase
+ * @var IDatabase
*/
protected $dbr;
diff --git a/includes/Utils/NamespaceIterator.php
b/includes/Utils/NamespaceIterator.php
index fe2be52..f49aa52 100644
--- a/includes/Utils/NamespaceIterator.php
+++ b/includes/Utils/NamespaceIterator.php
@@ -2,7 +2,7 @@
namespace Flow\Utils;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use BatchRowIterator;
use EchoCallbackIterator;
use IteratorAggregate;
@@ -15,7 +15,7 @@
*/
class NamespaceIterator implements IteratorAggregate {
/**
- * @var DatabaseBase A wiki database to read from
+ * @var IDatabase A wiki database to read from
*/
protected $db;
@@ -25,10 +25,10 @@
protected $namespace;
/**
- * @param DatabaseBase $db A wiki database to read from
+ * @param IDatabase $db A wiki database to read from
* @param int $namespace An NS_* namespace to iterate over
*/
- public function __construct( DatabaseBase $db, $namespace ) {
+ public function __construct( IDatabase $db, $namespace ) {
$this->db = $db;
$this->namespace = $namespace;
}
diff --git a/includes/Utils/PagesWithPropertyIterator.php
b/includes/Utils/PagesWithPropertyIterator.php
index 615c70e..458792a 100644
--- a/includes/Utils/PagesWithPropertyIterator.php
+++ b/includes/Utils/PagesWithPropertyIterator.php
@@ -2,7 +2,7 @@
namespace Flow\Utils;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use BatchRowIterator;
use EchoCallbackIterator;
use IteratorAggregate;
@@ -14,7 +14,7 @@
*/
class PagesWithPropertyIterator implements IteratorAggregate {
/**
- * @var DatabaseBase
+ * @var IDatabase
*/
protected $db;
@@ -38,12 +38,12 @@
protected $stopId = null;
/**
- * @param DatabaseBase $db
+ * @param IDatabase $db
* @param string $propName
* @param int|null $startId Page id to start at (inclusive)
* @param int|null $stopId Page id to stop at (exclusive)
*/
- public function __construct( DatabaseBase $db, $propName, $startId =
null, $stopId = null ) {
+ public function __construct( IDatabase $db, $propName, $startId = null,
$stopId = null ) {
$this->db = $db;
$this->propName = $propName;
$this->startId = $startId;
diff --git a/includes/WatchedTopicItems.php b/includes/WatchedTopicItems.php
index 8860a9e..d228f18 100644
--- a/includes/WatchedTopicItems.php
+++ b/includes/WatchedTopicItems.php
@@ -2,7 +2,7 @@
namespace Flow;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Exception\DataModelException;
use Title;
use User;
@@ -16,7 +16,7 @@
protected $watchListDb;
protected $overrides = [];
- public function __construct( User $user, DatabaseBase $watchListDb ) {
+ public function __construct( User $user, IDatabase $watchListDb ) {
$this->user = $user;
$this->watchListDb = $watchListDb;
}
@@ -87,7 +87,7 @@
}
/**
- * @return DatabaseBase
+ * @return IDatabase
*/
public function getWatchlistDb() {
return $this->watchListDb;
diff --git a/maintenance/FlowExternalStoreMoveCluster.php
b/maintenance/FlowExternalStoreMoveCluster.php
index 2cc1eee..db9262d 100644
--- a/maintenance/FlowExternalStoreMoveCluster.php
+++ b/maintenance/FlowExternalStoreMoveCluster.php
@@ -18,8 +18,8 @@
/**
* Must return an array in the form:
* array(
- * 'dbr' => DatabaseBase object,
- * 'dbw' => DatabaseBase object,
+ * 'dbr' => IDatabase object,
+ * 'dbw' => IDatabase object,
* 'table' => 'flow_revision',
* 'pk' => 'rev_id',
* 'content' => 'rev_content',
@@ -65,9 +65,9 @@
$to = explode( ',', $this->getOption( 'to' ) );
$schema = $this->schema();
- /** @var DatabaseBase $dbr */
+ /** @var IDatabase $dbr */
$dbr = $schema['dbr'];
- /** @var DatabaseBase $dbw */
+ /** @var IDatabase $dbw */
$dbw = $schema['dbw'];
$iterator = new BatchRowIterator( $dbr, $schema['table'],
$schema['pk'], $this->mBatchSize );
diff --git a/maintenance/FlowFixEditCount.php b/maintenance/FlowFixEditCount.php
index 54da776..3f2efca 100644
--- a/maintenance/FlowFixEditCount.php
+++ b/maintenance/FlowFixEditCount.php
@@ -39,7 +39,7 @@
}
protected function doDBUpdates() {
- /** @var DatabaseBase $dbr */
+ /** @var IDatabase $dbr */
$dbr = Container::get( 'db.factory' )->getDB( DB_REPLICA );
$countableActions = $this->getCountableActions();
@@ -62,7 +62,7 @@
return true;
}
- public function refreshBatch( DatabaseBase $dbr, UUID $continue,
$countableActions, UUID $stop ) {
+ public function refreshBatch( IDatabase $dbr, UUID $continue,
$countableActions, UUID $stop ) {
$rows = $dbr->select(
'flow_revision',
[ 'rev_id', 'rev_user_id' ],
diff --git a/maintenance/FlowFixUserIp.php b/maintenance/FlowFixUserIp.php
index b184a77..20352b5 100644
--- a/maintenance/FlowFixUserIp.php
+++ b/maintenance/FlowFixUserIp.php
@@ -66,7 +66,7 @@
return true;
}
- public function updateTreeRevision( DatabaseBase $dbw, $continue = null
) {
+ public function updateTreeRevision( IDatabase $dbw, $continue = null ) {
$rows = $dbw->select(
/* table */'flow_tree_revision',
/* select */[ 'tree_rev_id' ],
@@ -109,7 +109,7 @@
return end( $ids );
}
- public function updateRevision( $columnPrefix, DatabaseBase $dbw,
$continue = null ) {
+ public function updateRevision( $columnPrefix, IDatabase $dbw,
$continue = null ) {
$rows = $dbw->select(
/* table */'flow_revision',
/* select */[ 'rev_id', 'rev_type' ],
diff --git a/maintenance/FlowSetUserIp.php b/maintenance/FlowSetUserIp.php
index c19ab12..efa8a3f 100644
--- a/maintenance/FlowSetUserIp.php
+++ b/maintenance/FlowSetUserIp.php
@@ -66,11 +66,11 @@
/**
* Refreshes a batch of recentchanges entries
*
- * @param DatabaseBase $dbw
+ * @param IDatabase $dbw
* @param int[optional] $continue The next batch starting at rc_id
* @return int Start id for the next batch
*/
- public function updateWorkflow( DatabaseBase $dbw, $continue = null ) {
+ public function updateWorkflow( IDatabase $dbw, $continue = null ) {
$rows = $dbw->select(
/* table */'flow_workflow',
/* select */[ 'workflow_id', 'workflow_user_text' ],
@@ -100,7 +100,7 @@
return $continue;
}
- public function updateTreeRevision( DatabaseBase $dbw, $continue = null
) {
+ public function updateTreeRevision( IDatabase $dbw, $continue = null ) {
$rows = $dbw->select(
/* table */'flow_tree_revision',
/* select */[ 'tree_rev_id', 'tree_orig_user_text' ],
@@ -129,7 +129,7 @@
return $continue;
}
- public function updateRevision( DatabaseBase $dbw, $continue = null ) {
+ public function updateRevision( IDatabase $dbw, $continue = null ) {
$rows = $dbw->select(
/* table */'flow_revision',
/* select */[ 'rev_id', 'rev_user_id', 'rev_user_text',
'rev_mod_user_id', 'rev_mod_user_text', 'rev_edit_user_id',
'rev_edit_user_text' ],
diff --git a/maintenance/FlowUpdateRecentChanges.php
b/maintenance/FlowUpdateRecentChanges.php
index 9962309..19ed0c6 100644
--- a/maintenance/FlowUpdateRecentChanges.php
+++ b/maintenance/FlowUpdateRecentChanges.php
@@ -49,11 +49,11 @@
/**
* Refreshes a batch of recentchanges entries
*
- * @param DatabaseBase $dbw
+ * @param IDatabase $dbw
* @param int[optional] $continue The next batch starting at rc_id
* @return int Start id for the next batch
*/
- public function refreshBatch( DatabaseBase $dbw, $continue = null ) {
+ public function refreshBatch( IDatabase $dbw, $continue = null ) {
$rows = $dbw->select(
/* table */'recentchanges',
/* select */[ 'rc_id', 'rc_params' ],
diff --git a/tests/phpunit/Import/ConverterTest.php
b/tests/phpunit/Import/ConverterTest.php
index af1ad90..05b2b2b 100644
--- a/tests/phpunit/Import/ConverterTest.php
+++ b/tests/phpunit/Import/ConverterTest.php
@@ -2,7 +2,7 @@
namespace Flow\Tests\Import;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use Flow\Import\Converter;
use Flow\Import\IConversionStrategy;
use Flow\Import\Importer;
@@ -22,7 +22,7 @@
}
protected function createConverter(
- DatabaseBase $dbw = null,
+ IDatabase $dbw = null,
Importer $importer = null,
LoggerInterface $logger = null,
User $user = null,
diff --git a/tests/phpunit/Import/LiquidThreadsApi/ConversionStrategyTest.php
b/tests/phpunit/Import/LiquidThreadsApi/ConversionStrategyTest.php
index f0841f2..512c885 100644
--- a/tests/phpunit/Import/LiquidThreadsApi/ConversionStrategyTest.php
+++ b/tests/phpunit/Import/LiquidThreadsApi/ConversionStrategyTest.php
@@ -2,7 +2,7 @@
namespace Flow\Tests\Import\LiquidThreadsApi;
-use DatabaseBase;
+use Wikimedia\Rdbms\IDatabase;
use DateTime;
use DateTimeZone;
use Flow\Import\SourceStore\SourceStoreInterface as ImportSourceStore;
@@ -151,7 +151,7 @@
}
protected function createStrategy(
- DatabaseBase $dbr = null,
+ IDatabase $dbr = null,
ImportSourceStore $sourceStore = null,
ApiBackend $api = null
) {
--
To view, visit https://gerrit.wikimedia.org/r/399663
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibe9aa42a28c308dd04f41e6bd48fd97e20a27f65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits