58 $services = MediaWikiServices::getInstance();
59 $config = $services->getMainConfig();
60 $lbFactory = $services->getDBLoadBalancerFactory();
61 $batchSize = $config->get(
'UpdateRowsPerQuery' );
66 $dbw = $this->
getDB();
68 parent::doIncrementalUpdate();
74 DeferredUpdates::addCallableUpdate(
function () use (
$title ) {
75 $cat = Category::newFromName(
$title->getDBkey() );
76 $cat->refreshCountsIfSmall();
81 $dbw->delete(
'page_restrictions', [
'pr_page' => $id ], __METHOD__ );
84 $dbw->delete(
'redirect', [
'rd_from' => $id ], __METHOD__ );
87 $rcIdsForTitle = $dbw->selectFieldValues(
92 'rc_namespace' =>
$title->getNamespace(),
93 'rc_title' =>
$title->getDBkey(),
95 $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) )
99 $rcIdsForPage = $dbw->selectFieldValues(
102 [
'rc_type != ' .
RC_LOG,
'rc_cur_id' => $id ],
107 $rcIdBatches = array_chunk( array_merge( $rcIdsForTitle, $rcIdsForPage ), $batchSize );
108 foreach ( $rcIdBatches as $rcIdBatch ) {
109 $dbw->delete(
'recentchanges', [
'rc_id' => $rcIdBatch ], __METHOD__ );
110 if ( count( $rcIdBatches ) > 1 ) {
111 $lbFactory->commitAndWaitForReplication(
112 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
118 ScopedCallback::consume( $scopedLock );