Index: trunk/extensions/WikiForum/WikiForumClass.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | |
108 | 108 | $thread = $dbr->fetchObject( $dbr->select( |
109 | 109 | 'wikiforum_threads', |
110 | | - array( 'wft_thread', 'wft_user' ), |
| 110 | + array( 'wft_thread', 'wft_user', 'wft_forum' ), |
111 | 111 | array( 'wft_deleted' => 0, 'wft_thread' => intval( $threadId ) ), |
112 | 112 | __METHOD__ |
113 | 113 | )); |
— | — | @@ -129,6 +129,28 @@ |
130 | 130 | ), |
131 | 131 | __METHOD__ |
132 | 132 | ); |
| 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 | + ); |
133 | 155 | } else { |
134 | 156 | $result = false; |
135 | 157 | } |