Bug tracker

This ticket has been moved to our new tracker. Open Ticket PHPBB3-1174 now.

Removing global message > counter goes up (fix completed in vcs)

Well after I first installed the board I deleted the first auto message that the board itself provides and made my own global message and locked it.
After a while I remove the lock and removed the global message to a standard topic.
Then I deleted the topic itself and the forum's counter jumped to 16777215.

Picture: http://img430.imageshack.us/img430/7088/bug8bj.jpg

Comments / History

Posted by ToonArmy (Development Team Member) on Jul 5th 2006, 15:18

I was not able to reproduce the huge increase in counters, but I did find some differences between using the post editor to create global announcements and using the MCP. I have fixed these in this patch:

Code: Select all
Index: includes/mcp/mcp_main.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/includes/mcp/mcp_main.php,v
retrieving revision 1.35
diff -U3 -r1.35 mcp_main.php
--- includes/mcp/mcp_main.php   23 Jun 2006 14:25:21 -0000      1.35
+++ includes/mcp/mcp_main.php   5 Jul 2006 15:16:09 -0000
@@ -320,17 +320,41 @@
                        {
                                $sql = 'UPDATE ' . TOPICS_TABLE . "
                                        SET topic_type = $new_topic_type, forum_id = $forum_id
-                                               WHERE topic_id IN (" . implode(', ', $topic_ids) . ')
+                                       WHERE topic_id IN (" . implode(', ', $topic_ids) . ')
                                                AND forum_id = 0';
                                $db->sql_query($sql);
+
+                               // Update forum_ids for all posts
+                               $sql = 'UPDATE ' . POSTS_TABLE . "
+                                       SET forum_id = $forum_id
+                                       WHERE topic_id IN (" . implode(', ', $topic_ids) . ')
+                                               AND forum_id = 0';
+                               $db->sql_query($sql);
+
+                               sync('forum', 'forum_id', $forum_id);
                        }
                }
                else
                {
+                       // Globalise
+
+                       // Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement
+                       $sql = 'DELETE FROM ' . TOPICS_TABLE . '
+                               WHERE topic_moved_id IN ( ' . implode(', ', $topic_ids) . ')';
+                       $db->sql_query($sql);
+
                        $sql = 'UPDATE ' . TOPICS_TABLE . "
                                SET topic_type = $new_topic_type, forum_id = 0
-                               WHERE topic_id IN (" . implode(', ', $topic_ids) . ")";
+                               WHERE topic_id IN (" . implode(', ', $topic_ids) . ')';
                        $db->sql_query($sql);
+
+                       // Update forum_ids for all posts
+                       $sql = 'UPDATE ' . POSTS_TABLE . '
+                               SET forum_id = 0
+                               WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
+                       $db->sql_query($sql);
+
+                       sync('forum', 'forum_id', $forum_id);
                }

                $success_msg = (sizeof($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';

Linked ticket with changeset: r6148

Action performed by Anonymous (I am too lazy to register) on Jul 6th 2006, 15:00

Ticket details

Related SVN changesets