57 $services = MediaWikiServices::getInstance();
58 $config = $services->getMainConfig();
59 $lbFactory = $services->getDBLoadBalancerFactory();
60 $batchSize = $config->get(
'UpdateRowsPerQuery' );
65 $dbw = $this->
getDB();
67 parent::doIncrementalUpdate();
73 DeferredUpdates::addCallableUpdate(
static function () use (
$title ) {
74 $cat = Category::newFromName(
$title->getDBkey() );
75 $cat->refreshCountsIfSmall();
80 $dbw->delete(
'page_restrictions', [
'pr_page' => $id ], __METHOD__ );
83 $dbw->delete(
'redirect', [
'rd_from' => $id ], __METHOD__ );
86 $rcIdsForTitle = $dbw->selectFieldValues(
91 'rc_namespace' =>
$title->getNamespace(),
92 'rc_title' =>
$title->getDBkey(),
94 $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) )
98 $rcIdsForPage = $dbw->selectFieldValues(
101 [
'rc_type != ' .
RC_LOG,
'rc_cur_id' => $id ],
106 $rcIdBatches = array_chunk( array_merge( $rcIdsForTitle, $rcIdsForPage ), $batchSize );
107 foreach ( $rcIdBatches as $rcIdBatch ) {
108 $dbw->delete(
'recentchanges', [
'rc_id' => $rcIdBatch ], __METHOD__ );
109 if ( count( $rcIdBatches ) > 1 ) {
110 $lbFactory->commitAndWaitForReplication(
111 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]