r87838 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87837‎ | r87838 | r87839 >
Date:19:33, 10 May 2011
Author:ashley
Status:deferred
Tags:
Comment:
WikiForum: update counters (total amount of thread & replies on a forum) when a thread is deleted. This does not update the "Latest thread" column, though, hence the FIXME comment.
Modified paths:
  • /trunk/extensions/WikiForum/WikiForumClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiForum/WikiForumClass.php
@@ -106,7 +106,7 @@
107107
108108 $thread = $dbr->fetchObject( $dbr->select(
109109 'wikiforum_threads',
110 - array( 'wft_thread', 'wft_user' ),
 110+ array( 'wft_thread', 'wft_user', 'wft_forum' ),
111111 array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ),
112112 __METHOD__
113113 ));
@@ -129,6 +129,28 @@
130130 ),
131131 __METHOD__
132132 );
 133+ // Update threads/replies counters
 134+ $replyCount = $dbw->selectField(
 135+ 'wikiforum_threads',
 136+ 'wft_reply_count',
 137+ array( 'wft_thread' => intval( $thread->wft_thread ) ),
 138+ __METHOD__
 139+ );
 140+ $dbw->update(
 141+ 'wikiforum_forums',
 142+ array(
 143+ "wff_reply_count = wff_reply_count - $replyCount",
 144+ 'wff_thread_count = wff_thread_count - 1'
 145+ // @todo FIXME: update wff_last_post_user and
 146+ // wff_last_post_timestamp, too...but how?
 147+ //'wff_last_post_user' =>
 148+ //'wff_last_post_timestamp' =>
 149+ ),
 150+ array(
 151+ 'wff_forum' => intval( $thread->wft_forum )
 152+ ),
 153+ __METHOD__
 154+ );
133155 } else {
134156 $result = false;
135157 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r87875WikiForum: follow-up to r87838 -- update overview data on Special:WikiForum w...ashley13:04, 11 May 2011

Status & tagging log