Page MenuHomePhabricator

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



Related Objects

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:27 PM
bzimport set Reference to bz17155.
bzimport added a subscriber: Unknown Object (MLST).

Proposed fix: Move updateCategoryCounts() up a few lines


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.

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