Category counter not updated on article deletion
Closed, ResolvedPublic


In Article::doDeleteArticle(), the code for updating the category counters is executed after the delete on the categorylinks table, so the query

  1. Fix category table counts
		$cats = array();
		$res = $dbw->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__ );

will never return a result. Thus, the category counters aren't updated at all on article deletions.

Version: unspecified
Severity: minor

bzimport set Reference to bz17155.
bzimport added a subscriber: Unknown Object (MLST).
P.Copp created this task.Jan 25 2009, 9:20 PM

Proposed fix: Move updateCategoryCounts() up a few lines

Attached: bug17155.patch

ayg wrote:

Thanks for the report. This was inexplicably broken in r41018. I reverted the bad parts of that in r47318, backported to 1.14 in r47319.

ayg wrote:

(In reply to comment #2)

bad parts of that in r47318, backported to 1.14 in r47319.

That should be r47319 and r47320 respectively.

aaron added a comment.Feb 16 2009, 5:58 PM

Note that r41018 only moved the step below the RC row deletion and Article::onArticleDelete( $this->mTitle ) steps. r47319 Just reverted this.

The *above* patch moves this up before the page row deletion and more importantly before:

$dbw->delete( 'categorylinks', array( 'cl_from' => $id ) );

This seems to be actually broken by r40912.

Restored in r47326

Add Comment