From 0b9428f87a113452fbd2a8e44ed92d68f91e4c53 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 16 Sep 2008 13:29:01 +0000 Subject: [PATCH] * Deal with new page move scenario (bug 3481) * Move cat count stuff down in transaction for bug 13921 --- includes/Article.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 055cdedf15..aa5e5b69a5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2358,15 +2358,6 @@ class Article { # Delete restrictions for it $dbw->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__ ); - # Fix category table counts - $cats = array(); - $res = $dbw->select( 'categorylinks', 'cl_to', - array( 'cl_from' => $id ), __METHOD__ ); - foreach( $res as $row ) { - $cats []= $row->cl_to; - } - $this->updateCategoryCounts( array(), $cats ); - # Now that it's safely backed up, delete it $dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__); $ok = ( $dbw->affectedRows() > 0 ); // getArticleId() uses slave, could be laggy @@ -2391,13 +2382,20 @@ class Article { $dbw->delete( 'langlinks', array( 'll_from' => $id ) ); $dbw->delete( 'redirect', array( 'rd_from' => $id ) ); } + + # Fix category table counts + $cats = array(); + $res = $dbw->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__ ); + foreach( $res as $row ) { + $cats []= $row->cl_to; + } + $this->updateCategoryCounts( array(), $cats ); # If using cleanup triggers, we can skip some manual deletes if ( !$dbw->cleanupTriggers() ) { - # Clean up recentchanges entries... $dbw->delete( 'recentchanges', - array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG ), + array( 'rc_namespace' => $ns, 'rc_title' => $t, 'rc_type != '.RC_LOG, 'rc_cur_id' => $id ), __METHOD__ ); } $dbw->commit(); -- 2.20.1