http://www.mediawiki.org/wiki/Special:Code/MediaWiki/87875
Revision: 87875 Author: ashley Date: 2011-05-11 13:04:15 +0000 (Wed, 11 May 2011) Log Message: ----------- WikiForum: follow-up to r87838 -- update overview data on Special:WikiForum when a thread is deleted, part 2/2. Now when a thread is deleted, the forum's thread count, reply count, last poster's name and the timestamp of the latest post will be updated accordingly. Modified Paths: -------------- trunk/extensions/WikiForum/WikiForumClass.php Modified: trunk/extensions/WikiForum/WikiForumClass.php =================================================================== --- trunk/extensions/WikiForum/WikiForumClass.php 2011-05-11 12:38:19 UTC (rev 87874) +++ trunk/extensions/WikiForum/WikiForumClass.php 2011-05-11 13:04:15 UTC (rev 87875) @@ -136,15 +136,30 @@ array( 'wft_thread' => intval( $thread->wft_thread ) ), __METHOD__ ); + // When the thread we're about to delete is deleted, we also need + // to update the information about the latest post & its author + $new = $dbw->select( + 'wikiforum_threads', + array( + 'wft_last_post_user', 'wft_last_post_timestamp', + ), + array( + 'wft_forum' => intval( $thread->wft_forum ), + 'wft_deleted' => 0 // 0 means not deleted + ), + __METHOD__, + array( 'LIMIT' => 1 ) + ); + $row = $dbw->fetchRow( $new ); + // Update the forum table so that the data shown on + // Special:WikiForum is up to date $dbw->update( 'wikiforum_forums', array( "wff_reply_count = wff_reply_count - $replyCount", - 'wff_thread_count = wff_thread_count - 1' - // @todo FIXME: update wff_last_post_user and - // wff_last_post_timestamp, too...but how? - //'wff_last_post_user' => - //'wff_last_post_timestamp' => + 'wff_thread_count = wff_thread_count - 1', + 'wff_last_post_user' => intval( $row['wft_last_post_user'] ), + 'wff_last_post_timestamp' => intval( $row['wft_last_post_timestamp'] ) ), array( 'wff_forum' => intval( $thread->wft_forum ) _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs