}
}
- /**
- * @return bool|string
- */
- private function getWikiId() {
- // TODO: get from RevisionStore
- return false;
- }
-
/**
* Checks whether this DerivedPageDataUpdater can be re-used for running updates targeting
* the given revision.
// TODO: In the wiring, register a listener for this on the new PageEventEmitter
ResourceLoaderWikiModule::invalidateModuleCache(
- $title, $oldLegacyRevision, $legacyRevision, $this->getWikiId() ?: wfWikiID()
+ $title,
+ $oldLegacyRevision,
+ $legacyRevision,
+ $this->loadbalancerFactory->getLocalDomainID()
);
$this->doTransition( 'done' );
__METHOD__ );
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+ $dbDomain = $lbFactory->getLocalDomainID();
+
$n = 0;
foreach ( $result as $row ) {
$pageId = intval( $row->page_id );
[ 'rev_page' => $pageId ],
__METHOD__ );
if ( !$latestTime ) {
- $this->output( wfWikiID() . " $pageId [[$name]] can't find latest rev time?!\n" );
+ $this->output( "$dbDomain $pageId [[$name]] can't find latest rev time?!\n" );
continue;
}
$revision = Revision::loadFromTimestamp( $dbw, $title, $latestTime );
if ( is_null( $revision ) ) {
- $this->output( wfWikiID()
- . " $pageId [[$name]] latest time $latestTime, can't find revision id\n" );
+ $this->output(
+ "$dbDomain $pageId [[$name]] latest time $latestTime, can't find revision id\n"
+ );
continue;
}
$id = $revision->getId();
- $this->output( wfWikiID() . " $pageId [[$name]] latest time $latestTime, rev id $id\n" );
+ $this->output( "$dbDomain $pageId [[$name]] latest time $latestTime, rev id $id\n" );
if ( $this->hasOption( 'fix' ) ) {
$page = WikiPage::factory( $title );
$page->updateRevisionOn( $dbw, $revision );
$this->outputStatus( 'Done!' );
if ( $this->hasOption( 'fix' ) ) {
- $this->outputStatus( ' Cleaned up invalid DB keys on ' . wfWikiID() . "!\n" );
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
+ $this->outputStatus( " Cleaned up invalid DB keys on $dbDomain!\n" );
}
}
return;
} elseif ( count( $promotions ) !== 0 ) {
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
$promoText = "User:{$username} into " . implode( ', ', $promotions ) . "...\n";
if ( $exists ) {
- $this->output( wfWikiID() . ": Promoting $promoText" );
+ $this->output( "$dbDomain: Promoting $promoText" );
} else {
- $this->output( wfWikiID() . ": Creating and promoting $promoText" );
+ $this->output( "$dbDomain: Creating and promoting $promoText" );
}
}
$pageRatePart = '-';
$revRatePart = '-';
}
+
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
$this->progress( sprintf(
"%s: %s (ID %d) %d pages (%0.1f|%0.1f/sec all|curr), "
. "%d revs (%0.1f|%0.1f/sec all|curr), ETA %s [max %d]",
- $now, wfWikiID(), $this->ID, $this->pageCount, $pageRate,
+ $now, $dbDomain, $this->ID, $this->pageCount, $pageRate,
$pageRatePart, $this->revCount, $revRate, $revRatePart, $etats,
$this->maxCount
) );
$pageRatePart = '-';
$revRatePart = '-';
}
+
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
$this->progress( sprintf(
"%s: %s (ID %d) %d pages (%0.1f|%0.1f/sec all|curr), "
. "%d revs (%0.1f|%0.1f/sec all|curr), %0.1f%%|%0.1f%% "
. "prefetched (all|curr), ETA %s [max %d]",
- $now, wfWikiID(), $this->ID, $this->pageCount, $pageRate,
+ $now, $dbDomain, $this->ID, $this->pageCount, $pageRate,
$pageRatePart, $this->revCount, $revRate, $revRatePart,
$fetchRate, $fetchRatePart, $etats, $this->maxCount
) );
$delta = microtime( true ) - $start;
$rate = ( $delta == 0.0 ) ? 0.0 : $migrated / $delta;
$this->output( sprintf( "%s %d (%0.1f%%) done in %0.1f secs (%0.3f accounts/sec).\n",
- wfWikiID(),
+ WikiMap::getCurrentWikiDbDomain()->getId(),
$migrated,
min( $max, $lastUser ) / $lastUser * 100.0,
$delta,
if ( $this->replicaId !== false ) {
$header .= "({$this->replicaId})";
}
- $header .= ' ' . wfWikiID();
+ $header .= ' ' . WikiMap::getCurrentWikiDbDomain()->getId();
LegacyLogger::emit( sprintf( "%-50s %s\n", $header, $msg ), $file );
}
$src = FileBackendGroup::singleton()->get( $this->getOption( 'src' ) );
$posDir = $this->getOption( 'posdir' );
- $posFile = $posDir ? $posDir . '/' . wfWikiID() : false;
+ if ( $posDir != '' ) {
+ $posFile = "$posDir/" . rawurlencode( $src->getDomainId() );
+ } else {
+ $posFile = false;
+ }
if ( $this->hasOption( 'posdump' ) ) {
// Just dump the current position into the specified position dir
require_once __DIR__ . '/Maintenance.php';
use Wikimedia\Rdbms\IMaintainableDatabase;
+use Wikimedia\Rdbms\DatabaseSqlite;
/**
* Maintenance script to run database schema updates.
$this->fatalError( $text );
}
- $this->output( "Going to run database updates for " . wfWikiID() . "\n" );
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
+ $this->output( "Going to run database updates for $dbDomain\n" );
if ( $db->getType() === 'sqlite' ) {
/** @var IMaintainableDatabase|DatabaseSqlite $db */
$this->output( "Using SQLite file: '{$db->getDbFilePath()}'\n" );
}
public function execute() {
- $posFile = $this->getOption( 'p', 'searchUpdate.' . wfWikiID() . '.pos' );
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
+ $posFile = $this->getOption( 'p', 'searchUpdate.' . rawurlencode( $dbDomain ) . '.pos' );
$end = $this->getOption( 'e', wfTimestampNow() );
if ( $this->hasOption( 's' ) ) {
$start = $this->getOption( 's' );