23 use Wikimedia\ScopedCallback;
47 parent::__construct();
55 throw new InvalidArgumentException(
"Page ID not known. Page doesn't exist?" );
62 $services = MediaWikiServices::getInstance();
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 ) {
94 __METHOD__, $this->ticket, [
'wiki' => $dbw->getWikiID() ]
102 $row = $dbw->selectRow(
104 [
'cat_id',
'cat_title',
'cat_pages',
'cat_subcats',
'cat_files' ],
105 [
'cat_title' =>
$title->getDBkey(),
'cat_pages <= 0' ],
115 [
'pl_from' => $id ],
116 [
'pl_from',
'pl_namespace',
'pl_title' ],
121 [
'il_from' => $id ],
122 [
'il_from',
'il_to' ],
127 [
'cl_from' => $id ],
128 [
'cl_from',
'cl_to' ],
133 [
'tl_from' => $id ],
134 [
'tl_from',
'tl_namespace',
'tl_title' ],
139 [
'el_from' => $id ],
145 [
'll_from' => $id ],
146 [
'll_from',
'll_lang' ],
151 [
'iwl_from' => $id ],
152 [
'iwl_from',
'iwl_prefix',
'iwl_title' ],
157 $dbw->delete(
'redirect', [
'rd_from' => $id ], __METHOD__ );
158 $dbw->delete(
'page_props', [
'pp_page' => $id ], __METHOD__ );
161 $rcIdsForTitle = $dbw->selectFieldValues(
166 'rc_namespace' =>
$title->getNamespace(),
167 'rc_title' =>
$title->getDBkey(),
169 $dbw->addQuotes( $dbw->timestamp( $this->timestamp ) )
173 $rcIdsForPage = $dbw->selectFieldValues(
176 [
'rc_type != ' .
RC_LOG,
'rc_cur_id' => $id ],
181 $rcIdBatches = array_chunk( array_merge( $rcIdsForTitle, $rcIdsForPage ), $batchSize );
182 foreach ( $rcIdBatches
as $rcIdBatch ) {
183 $dbw->delete(
'recentchanges', [
'rc_id' => $rcIdBatch ], __METHOD__ );
184 if (
count( $rcIdBatches ) > 1 ) {
186 __METHOD__, $this->ticket, [
'wiki' => $dbw->getWikiID() ]
192 ScopedCallback::consume( $scopedLock );
196 $services = MediaWikiServices::getInstance();
198 $dbw = $this->
getDB();
200 $res = $dbw->select( $table, $pk, $conds, __METHOD__ );
203 foreach (
$res as $row ) {
205 if (
count( $pkDeleteConds ) >= $bSize ) {
206 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );
208 __METHOD__, $this->ticket, [
'wiki' => $dbw->getWikiID() ]
214 if ( $pkDeleteConds ) {
215 $dbw->delete( $table, $dbw->makeList( $pkDeleteConds,
LIST_OR ), __METHOD__ );
229 'wiki' => $this->
getDB()->getWikiID(),
232 [
'pageId' => $this->pageId,
'timestamp' => $this->timestamp ],
233 [
'removeDuplicates' =>
true ],
234 $this->
page->getTitle()