require_once __DIR__ . '/Maintenance.php';
+use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\DBQueryError;
+
/**
* Maintenance script that sends SQL queries from the specified file to the database.
*
$wiki = $this->hasOption( 'wikidb' ) ? $this->getOption( 'wikidb' ) : false;
// Get the appropriate load balancer (for this wiki)
if ( $this->hasOption( 'cluster' ) ) {
- $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ), $wiki );
+ $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ) );
} else {
$lb = wfGetLB( $wiki );
}
$index = DB_MASTER;
}
- /** @var Database $db DB handle for the appropriate cluster/wiki */
+ /** @var IDatabase $db DB handle for the appropriate cluster/wiki */
$db = $lb->getConnection( $index, [], $wiki );
if ( $replicaDB != '' && $db->getLBInfo( 'master' ) !== null ) {
$this->error( "The server selected ({$db->getServer()}) is not a replica DB.", 1 );
/**
* Print the results, callback for $db->sourceStream()
- * @param ResultWrapper $res The results object
+ * @param ResultWrapper|bool $res The results object
* @param IDatabase $db
*/
public function sqlPrintResult( $res, $db ) {