23 use Wikimedia\ScopedCallback;
47 parent::__construct();
55 throw new InvalidArgumentException(
"Page ID not known. Page doesn't exist?" );
62 $services = MediaWikiServices::getInstance();
64 $lbFactory =
$services->getDBLoadBalancerFactory();
65 $batchSize = $config->get(
'UpdateRowsPerQuery' );
70 if ( $this->ticket ) {
77 $dbw = $this->
getDB();
80 $dbw->delete(
'page_restrictions', [
'pr_page' => $id ], __METHOD__ );
83 $cats = $dbw->selectFieldValues(
89 $catBatches = array_chunk( $cats, $batchSize );
90 foreach ( $catBatches
as $catBatch ) {
91 $this->
page->updateCategoryCounts( [], $catBatch, $id );
92 if (
count( $catBatches ) > 1 ) {
93 $lbFactory->commitAndWaitForReplication(
94 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
102 $row = $dbw->selectRow(
104 [
'cat_id',
'cat_title',
'cat_pages',
'cat_subcats',
'cat_files' ],
105 [
'cat_title' =>
$title->getDBkey(),
'cat_pages <= 0' ],
112 $cat->refreshCounts();
119 [
'pl_from' => $id ],
120 [
'pl_from',
'pl_namespace',
'pl_title' ],
125 [
'il_from' => $id ],
126 [
'il_from',
'il_to' ],
131 [
'cl_from' => $id ],
132 [
'cl_from',
'cl_to' ],
137 [
'tl_from' => $id ],
138 [
'tl_from',
'tl_namespace',
'tl_title' ],
143 [
'el_from' => $id ],
149 [
'll_from' => $id ],
150 [
'll_from',
'll_lang' ],
155 [
'iwl_from' => $id ],
156 [
'iwl_from',
'iwl_prefix',
'iwl_title' ],
161 $dbw->delete(
'redirect', [
'rd_from' => $id ], __METHOD__ );
162 $dbw->delete(
'page_props', [
'pp_page' => $id ], __METHOD__ );
165 $rcIdsForTitle = $dbw->selectFieldValues(
170 'rc_namespace' =>
$title->getNamespace(),
171 'rc_title' =>
$title->getDBkey(),
173 $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) )
177 $rcIdsForPage = $dbw->selectFieldValues(
180 [
'rc_type != ' .
RC_LOG,
'rc_cur_id' => $id ],
185 $rcIdBatches = array_chunk( array_merge( $rcIdsForTitle, $rcIdsForPage ), $batchSize );
186 foreach ( $rcIdBatches
as $rcIdBatch ) {
187 $dbw->delete(
'recentchanges', [
'rc_id' => $rcIdBatch ], __METHOD__ );
188 if (
count( $rcIdBatches ) > 1 ) {
189 $lbFactory->commitAndWaitForReplication(
190 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
196 ScopedCallback::consume( $scopedLock );
200 $services = MediaWikiServices::getInstance();
201 $lbFactory =
$services->getDBLoadBalancerFactory();
202 $dbw = $this->
getDB();
204 $res = $dbw->select( $table, $pk, $conds, __METHOD__ );
207 foreach (
$res as $row ) {
209 if (
count( $pkDeleteConds ) >= $bSize ) {
210 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );
211 $lbFactory->commitAndWaitForReplication(
212 __METHOD__, $this->ticket, [
'domain' => $dbw->getDomainID() ]
218 if ( $pkDeleteConds ) {
219 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );
236 [
'pageId' => $this->pageId,
'timestamp' => $this->timestamp ],
237 [
'removeDuplicates' =>
true ],
238 $this->
page->getTitle()