// Clean up spam on all wikis
$this->output( "Finding spam on " . count( $wgLocalDatabases ) . " wikis\n" );
$found = false;
- foreach ( $wgLocalDatabases as $wikiID ) {
+ foreach ( $wgLocalDatabases as $wikiId ) {
/** @var Database $dbr */
- $dbr = $this->getDB( DB_REPLICA, [], $wikiID );
+ $dbr = $this->getDB( DB_REPLICA, [], $wikiId );
foreach ( $protConds as $conds ) {
$count = $dbr->selectField(
$found = true;
$cmd = wfShellWikiCmd(
"$IP/maintenance/cleanupSpam.php",
- [ '--wiki', $wikiID, $spec ]
+ [ '--wiki', $wikiId, $spec ]
);
- passthru( "$cmd | sed 's/^/$wikiID: /'" );
+ passthru( "$cmd | sed 's/^/$wikiId: /'" );
}
}
}
$prefixes[] = $row->iw_prefix;
}
- foreach ( $wgLocalDatabases as $db ) {
- $this->output( "$db..." );
+ foreach ( $wgLocalDatabases as $wikiId ) {
+ $this->output( "$wikiId..." );
foreach ( $prefixes as $prefix ) {
- $wgMemc->delete( "$db:interwiki:$prefix" );
+ $wgMemc->delete( "$wikiId:interwiki:$prefix" );
}
$this->output( "done\n" );
}
? JobQueueGroup::singleton()->getQueueTypes()
: [ $this->getOption( 'type' ) ];
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
foreach ( $types as $type ) {
- $baseConfig = [ 'type' => $type, 'wiki' => wfWikiID() ];
+ $baseConfig = [ 'type' => $type, 'domain' => $dbDomain ];
$src = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$srcKey] );
$dst = JobQueue::factory( $baseConfig + $wgJobQueueMigrationConfig[$dstKey] );
$this->fatalError( "Can not create directory $fspath." );
}
+ $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId();
$this->fspath = realpath( $fspath ) . DIRECTORY_SEPARATOR;
$this->urlpath = $this->getOption( 'urlpath', "" );
if ( $this->urlpath !== "" && substr( $this->urlpath, -1 ) !== '/' ) {
$this->urlpath .= '/';
}
- $this->identifier = $this->getOption( 'identifier', wfWikiID() );
+ $this->identifier = $this->getOption( 'identifier', $dbDomain );
$this->compress = $this->getOption( 'compress', 'yes' ) !== 'no';
$this->skipRedirects = $this->hasOption( 'skip-redirects' );
$this->dbr = $this->getDB( DB_REPLICA );
$this->generateNamespaces();
$this->timestamp = wfTimestamp( TS_ISO_8601, wfTimestampNow() );
- $this->findex = fopen( "{$this->fspath}sitemap-index-{$this->identifier}.xml", 'wb' );
+ $encIdentifier = rawurlencode( $this->identifier );
+ $this->findex = fopen( "{$this->fspath}sitemap-index-{$encIdentifier}.xml", 'wb' );
$this->main();
}
function openSpawn() {
global $IP;
+ $wiki = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
if ( count( $this->php ) == 2 ) {
$mwscriptpath = $this->php[1];
} else {
$this->php[0],
$mwscriptpath,
"fetchText.php",
- '--wiki', wfWikiID() ] ) );
+ '--wiki', $wiki ] ) );
} else {
$cmd = implode( " ",
array_map( [ Shell::class, 'escape' ],
[
$this->php[0],
"$IP/maintenance/fetchText.php",
- '--wiki', wfWikiID() ] ) );
+ '--wiki', $wiki ] ) );
}
$spec = [
0 => [ "pipe", "r" ],
* 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 = [];