*/
private $user;
- const BATCH_SIZE = 500; // try to keep typical updates in a single transaction
-
/**
* Constructor
*
* @param array $insertions Rows to insert
*/
private function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
+ $bSize = RequestContext::getMain()->getConfig()->get( 'UpdateRowsPerQuery' );
+
if ( $table === 'page_props' ) {
$fromField = 'pp_page';
} else {
foreach ( $deletions as $ns => $dbKeys ) {
foreach ( $dbKeys as $dbKey => $unused ) {
$curDeletionBatch[$ns][$dbKey] = 1;
- if ( ++$curBatchSize >= self::BATCH_SIZE ) {
+ if ( ++$curBatchSize >= $bSize ) {
$deletionBatches[] = $curDeletionBatch;
$curDeletionBatch = [];
$curBatchSize = 0;
$toField = $prefix . '_to';
}
- $deletionBatches = array_chunk( array_keys( $deletions ), self::BATCH_SIZE );
+ $deletionBatches = array_chunk( array_keys( $deletions ), $bSize );
foreach ( $deletionBatches as $deletionBatch ) {
$deleteWheres[] = [ $fromField => $this->mId, $toField => $deletionBatch ];
}
wfGetLBFactory()->waitForReplication( [ 'wiki' => $this->mDb->getWikiID() ] );
}
- $insertBatches = array_chunk( $insertions, self::BATCH_SIZE );
+ $insertBatches = array_chunk( $insertions, $bSize );
foreach ( $insertBatches as $insertBatch ) {
$this->mDb->insert( $table, $insertBatch, __METHOD__, 'IGNORE' );
$this->mDb->commit( __METHOD__, 'flush' );
$this->mRevision = $revision;
}
+ /**
+ * @since 1.28
+ * @return null|Revision
+ */
+ public function getRevision() {
+ return $this->mRevision;
+ }
+
/**
* Set the User who triggered this LinksUpdate
*