23 use Wikimedia\ScopedCallback;
47 throw new InvalidArgumentException(
"Page ID not known. Page doesn't exist?" );
58 $services = MediaWikiServices::getInstance();
59 $config = $services->getMainConfig();
60 $lbFactory = $services->getDBLoadBalancerFactory();
61 $batchSize = $config->get(
'UpdateRowsPerQuery' );
66 $dbw = $this->
getDB();
68 parent::doIncrementalUpdate();
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 );
123 'domain' => $this->
getDB()->getDomainID(),
126 [
'pageId' => $this->mId,
'timestamp' => $this->timestamp ],
127 [
'removeDuplicates' =>
true ],