X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fdeferred%2FLinksDeletionUpdate.php;h=0009781f567ae50d426339ea76a9b02447631855;hb=eaeeea4b29ffa13c75c4150d84360cfd38332311;hp=a7c39ca625acf0662d1afa48fee5fa5a37f166ca;hpb=d267aa2084360e03c8d9e385efb40111f478e059;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/deferred/LinksDeletionUpdate.php b/includes/deferred/LinksDeletionUpdate.php index a7c39ca625..0009781f56 100644 --- a/includes/deferred/LinksDeletionUpdate.php +++ b/includes/deferred/LinksDeletionUpdate.php @@ -61,6 +61,8 @@ class LinksDeletionUpdate extends SqlDataUpdate implements EnqueueableDataUpdate // This handles the case when updates have to batched into several COMMITs. $scopedLock = LinksUpdate::acquirePageLock( $this->mDb, $id ); + $title = $this->page->getTitle(); + // Delete restrictions for it $this->mDb->delete( 'page_restrictions', [ 'pr_page' => $id ], __METHOD__ ); @@ -80,6 +82,20 @@ class LinksDeletionUpdate extends SqlDataUpdate implements EnqueueableDataUpdate } } + // Refresh the category table entry if it seems to have no pages. Check + // master for the most up-to-date cat_pages count. + if ( $title->getNamespace() === NS_CATEGORY ) { + $row = $this->mDb->selectRow( + 'category', + [ 'cat_id', 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files' ], + [ 'cat_title' => $title->getDBkey(), 'cat_pages <= 0' ], + __METHOD__ + ); + if ( $row ) { + $cat = Category::newFromRow( $row, $title )->refreshCounts(); + } + } + // If using cascading deletes, we can skip some explicit deletes if ( !$this->mDb->cascadingDeletes() ) { // Delete outgoing links @@ -132,7 +148,6 @@ class LinksDeletionUpdate extends SqlDataUpdate implements EnqueueableDataUpdate // If using cleanup triggers, we can skip some manual deletes if ( !$this->mDb->cleanupTriggers() ) { - $title = $this->page->getTitle(); // Find recentchanges entries to clean up... $rcIdsForTitle = $this->mDb->selectFieldValues( 'recentchanges', @@ -164,10 +179,8 @@ class LinksDeletionUpdate extends SqlDataUpdate implements EnqueueableDataUpdate } } - $this->mDb->onTransactionIdle( function() use ( &$scopedLock ) { - // Release the lock *after* the final COMMIT for correctness - ScopedCallback::consume( $scopedLock ); - } ); + // Commit and release the lock + ScopedCallback::consume( $scopedLock ); } private function batchDeleteByPK( $table, array $conds, array $pk, $bSize ) {