public function __construct() {
parent::__construct();
$this->mDescription = "";
-
}
-
+
+ public function getDbType() {
+ return Maintenance::DB_ADMIN;
+ }
+
public function execute() {
$this->slaveIndexes = array();
for ( $i = 1; $i < wfGetLB()->getServerCount(); $i++ ) {
if ( $this->hasArg() ) {
$this->desyncFixPage( $this->getArg() );
} else {
- $dbw = wfGetDB( DB_MASTER );
- $maxPage = $dbw->selectField( 'page', 'MAX(page_id)', false, __METHOD__ );
$corrupt = $this->findPageLatestCorruption();
foreach ( $corrupt as $id => $dummy ) {
$this->desyncFixPage( $id );
$masterIDs[] = $row->rev_id;
}
- $res = $db->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ );
+ $res = $dbw->select( 'revision', array( 'rev_id' ), array( 'rev_page' => $pageID ), __METHOD__ );
$slaveIDs = array();
foreach ( $res as $row ) {
$slaveIDs[] = $row->rev_id;
$missingIDs = array_diff( $slaveIDs, $masterIDs );
if ( count( $missingIDs ) ) {
$this->output( "Found " . count( $missingIDs ) . " lost in master, copying from slave... " );
- $dbFrom = $db;
+ $dbFrom = $dbw;
$found = true;
$toMaster = true;
} else {
}
$maintClass = "FixSlaveDesync";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );