* @ingroup Maintenance
*/
+use MediaWiki\Storage\RevisionRecord;
+
require_once __DIR__ . '/Maintenance.php';
/**
// 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: /'" );
}
}
}
$rev = Revision::newFromTitle( $title );
$currentRevId = $rev->getId();
- while ( $rev && ( $rev->isDeleted( Revision::DELETED_TEXT )
- || LinkFilter::matchEntry( $rev->getContent( Revision::RAW ), $domain, $protocol ) )
+ while ( $rev && ( $rev->isDeleted( RevisionRecord::DELETED_TEXT )
+ || LinkFilter::matchEntry( $rev->getContent( RevisionRecord::RAW ), $domain, $protocol ) )
) {
$rev = $rev->getPrevious();
}
$page = WikiPage::factory( $title );
if ( $rev ) {
// Revert to this revision
- $content = $rev->getContent( Revision::RAW );
+ $content = $rev->getContent( RevisionRecord::RAW );
$this->output( "reverting\n" );
$page->doEditContent(
$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
) );
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" ],
if ( $this->replicaId !== false ) {
$header .= "({$this->replicaId})";
}
- $header .= ' ' . wfWikiID();
+ $header .= ' ' . WikiMap::getCurrentWikiDbDomain()->getId();
LegacyLogger::emit( sprintf( "%-50s %s\n", $header, $msg ), $file );
}
* 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 = [];