getDBLoadBalancerFactory(); // Determine which pages need to be updated. // This is necessary to prevent the job queue from smashing the DB with // large numbers of concurrent invalidations of the same page. $now = $dbw->timestamp(); $ids = $dbw->selectFieldValues( 'page', 'page_id', [ 'page_namespace' => $namespace, 'page_title' => $dbkeys, 'page_touched < ' . $dbw->addQuotes( $now ) ], $fname ); if ( !$ids ) { return; } $batchSize = $services->getMainConfig()->get( 'UpdateRowsPerQuery' ); $ticket = $lbFactory->getEmptyTransactionTicket( $fname ); $idBatches = array_chunk( $ids, $batchSize ); foreach ( $idBatches as $idBatch ) { $dbw->update( 'page', [ 'page_touched' => $now ], [ 'page_id' => $idBatch, 'page_touched < ' . $dbw->addQuotes( $now ) // handle races ], $fname ); if ( count( $idBatches ) > 1 ) { $lbFactory->commitAndWaitForReplication( $fname, $ticket ); } } } ) ); } }