$this->res = false;
$dbw = wfGetDB( DB_MASTER );
$this->doQuery( $dbw );
- $dbw->begin( __METHOD__ );
+
+ $dbw->startAtomic( __METHOD__ );
+
$status = Status::newGood();
$missing = array_flip( $this->ids );
$this->clearFileOps();
'authorIds' => $authorIds,
'authorIPs' => $authorIPs
) );
- $dbw->commit( __METHOD__ );
// Clear caches
- $status->merge( $this->doPostCommitUpdates() );
+ $that = $this;
+ $dbw->onTransactionIdle( function() use ( $that ) {
+ $that->doPostCommitUpdates();
+ } );
+
+ $dbw->endAtomic( __METHOD__ );
+
return $status;
}
} else {
$logType = 'delete';
}
- // Add params for effected page and ids
+ // Add params for affected page and ids
$logParams = $this->getLogParams( $params );
// Actually add the deletion log entry
- $log = new LogPage( $logType );
- $logid = $log->addEntry( $this->getLogAction(), $params['title'],
- $params['comment'], $logParams, $this->getUser() );
+ $logEntry = new ManualLogEntry( $logType, $this->getLogAction() );
+ $logEntry->setTarget( $params['title'] );
+ $logEntry->setComment( $params['comment'] );
+ $logEntry->setParameters( $logParams );
+ $logEntry->setPerformer( $this->getUser() );
// Allow for easy searching of deletion log items for revision/log items
- $log->addRelations( $field, $params['ids'], $logid );
- $log->addRelations( 'target_author_id', $params['authorIds'], $logid );
- $log->addRelations( 'target_author_ip', $params['authorIPs'], $logid );
+ $logEntry->setRelations( array(
+ $field => $params['ids'],
+ 'target_author_id' => $params['authorIds'],
+ 'target_author_ip' => $params['authorIPs'],
+ ) );
+ $logId = $logEntry->insert();
+ $logEntry->publish( $logId );
}
/**
*/
public function getLogParams( $params ) {
return array(
- $this->getType(),
- implode( ',', $params['ids'] ),
- "ofield={$params['oldBits']}",
- "nfield={$params['newBits']}"
+ '4::type' => $this->getType(),
+ '5::ids' => $params['ids'],
+ '6::ofield' => $params['oldBits'],
+ '7::nfield' => $params['newBits'],
);
}