* @ingroup Maintenance ExternalStorage
*/
+use Wikimedia\Rdbms\IMaintainableDatabase;
use MediaWiki\Logger\LegacyLogger;
use MediaWiki\MediaWikiServices;
use MediaWiki\Shell\Shell;
-use Wikimedia\Rdbms\IDatabase;
$optionsWithArgs = RecompressTracked::getOptionsWithArgs();
require __DIR__ . '/../commandLine.inc';
* writing are all slow.
*/
function startReplicaProcs() {
+ $wiki = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
+
$cmd = 'php ' . Shell::escape( __FILE__ );
foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
if ( $cmdOption == 'replica-id' ) {
}
}
$cmd .= ' --child' .
- ' --wiki ' . Shell::escape( wfWikiID() ) .
+ ' --wiki ' . Shell::escape( $wiki ) .
' ' . Shell::escape( ...$this->destClusters );
$this->replicaPipes = $this->replicaProcs = [];
/**
* Dispatch a command to the next available replica DB.
* This may block until a replica DB finishes its work and becomes available.
+ * @param array ...$args
*/
function dispatch( ...$args ) {
$pipes = $this->replicaPipes;
/**
* Gets a DB master connection for the given external cluster name
* @param string $cluster
- * @return IDatabase
+ * @return IMaintainableDatabase
*/
function getExtDB( $cluster ) {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$lb = $lbFactory->getExternalLB( $cluster );
- return $lb->getConnection( DB_MASTER );
+ return $lb->getMaintenanceConnectionRef( DB_MASTER );
}
/**