62 $services = MediaWikiServices::getInstance();
64 $lbFactory =
$services->getDBLoadBalancerFactory();
65 $batchSize = $config->get(
'UpdateRowsPerQuery' );
70 if ( $this->ticket ) {
73 $scopedLock = LinksUpdate::acquirePageLock( $this->
getDB(), $id );
75 throw new RuntimeException(
"Could not acquire lock for page ID '{$id}'." );
79 $title = $this->page->getTitle();
80 $dbw = $this->
getDB();
83 $dbw->delete(
'page_restrictions', [
'pr_page' => $id ], __METHOD__ );
86 $cats = $dbw->selectFieldValues(
92 $catBatches = array_chunk( $cats, $batchSize );
93 foreach ( $catBatches as $catBatch ) {
94 $this->page->updateCategoryCounts( [], $catBatch, $id );
95 if ( count( $catBatches ) > 1 ) {
97 $lbFactory->commitAndWaitForReplication(
98 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
106 DeferredUpdates::addCallableUpdate(
function () use ( $title ) {
107 $cat = Category::newFromName( $title->getDBkey() );
108 $cat->refreshCountsIfEmpty();
114 [
'pl_from' => $id ],
115 [
'pl_from',
'pl_namespace',
'pl_title' ],
120 [
'il_from' => $id ],
121 [
'il_from',
'il_to' ],
126 [
'cl_from' => $id ],
127 [
'cl_from',
'cl_to' ],
132 [
'tl_from' => $id ],
133 [
'tl_from',
'tl_namespace',
'tl_title' ],
138 [
'el_from' => $id ],
144 [
'll_from' => $id ],
145 [
'll_from',
'll_lang' ],
150 [
'iwl_from' => $id ],
151 [
'iwl_from',
'iwl_prefix',
'iwl_title' ],
156 $dbw->delete(
'redirect', [
'rd_from' => $id ], __METHOD__ );
157 $dbw->delete(
'page_props', [
'pp_page' => $id ], __METHOD__ );
160 $rcIdsForTitle = $dbw->selectFieldValues(
165 'rc_namespace' => $title->getNamespace(),
166 'rc_title' => $title->getDBkey(),
168 $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) )
172 $rcIdsForPage = $dbw->selectFieldValues(
175 [
'rc_type != ' .
RC_LOG,
'rc_cur_id' => $id ],
180 $rcIdBatches = array_chunk( array_merge( $rcIdsForTitle, $rcIdsForPage ), $batchSize );
181 foreach ( $rcIdBatches as $rcIdBatch ) {
182 $dbw->delete(
'recentchanges', [
'rc_id' => $rcIdBatch ], __METHOD__ );
183 if ( count( $rcIdBatches ) > 1 ) {
184 $lbFactory->commitAndWaitForReplication(
185 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
191 ScopedCallback::consume( $scopedLock );
195 $services = MediaWikiServices::getInstance();
196 $lbFactory =
$services->getDBLoadBalancerFactory();
197 $dbw = $this->
getDB();
199 $res = $dbw->select( $table, $pk, $conds, __METHOD__ );
202 foreach (
$res as $row ) {
204 if ( count( $pkDeleteConds ) >= $bSize ) {
205 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );
206 $lbFactory->commitAndWaitForReplication(
207 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
213 if ( $pkDeleteConds ) {
214 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );