From 9c2a58eff4c2bd164ee3bdb2ec66729d4562963d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 9 Nov 2012 13:37:53 +0100 Subject: [feature/soft-delete] Append _approved to *_posts and *_topics column names PHPBB3-9567 --- phpBB/develop/create_schema_files.php | 6 +++--- phpBB/develop/mysql_upgrader.php | 6 +++--- phpBB/feed.php | 4 ++-- phpBB/includes/acp/acp_forums.php | 10 +++++----- phpBB/includes/content_visibility.php | 14 +++++++------- phpBB/includes/functions_admin.php | 14 +++++++------- phpBB/includes/functions_posting.php | 9 +++++---- phpBB/includes/mcp/mcp_main.php | 6 +++--- phpBB/includes/mcp/mcp_queue.php | 2 +- phpBB/install/convertors/convert_phpbb20.php | 2 +- phpBB/install/convertors/functions_phpbb20.php | 6 ++++-- phpBB/install/database_update.php | 16 +++++++++------- phpBB/install/schemas/firebird_schema.sql | 6 +++--- phpBB/install/schemas/mssql_schema.sql | 6 +++--- phpBB/install/schemas/mysql_40_schema.sql | 6 +++--- phpBB/install/schemas/mysql_41_schema.sql | 6 +++--- phpBB/install/schemas/oracle_schema.sql | 6 +++--- phpBB/install/schemas/postgres_schema.sql | 6 +++--- phpBB/install/schemas/sqlite_schema.sql | 6 +++--- phpBB/mcp.php | 2 +- phpBB/posting.php | 8 ++++---- 21 files changed, 76 insertions(+), 71 deletions(-) (limited to 'phpBB') diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index ef679b1ea2..48fcfa9953 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -1096,10 +1096,10 @@ function get_schema_struct() 'forum_topics_per_page' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0), - 'forum_posts' => array('UINT', 0), + 'forum_posts_approved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0), - 'forum_topics' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0), @@ -1686,7 +1686,7 @@ function get_schema_struct() 'topic_time' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0), 'topic_views' => array('UINT', 0), - 'topic_posts' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0), 'topic_status' => array('TINT:3', 0), diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php index 5fd3e67ee4..597dd5e932 100644 --- a/phpBB/develop/mysql_upgrader.php +++ b/phpBB/develop/mysql_upgrader.php @@ -552,10 +552,10 @@ function get_schema_struct() 'forum_topics_per_page' => array('TINT:4', 0), 'forum_type' => array('TINT:4', 0), 'forum_status' => array('TINT:4', 0), - 'forum_posts' => array('UINT', 0), + 'forum_posts_approved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0), - 'forum_topics' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0), 'forum_last_post_id' => array('UINT', 0), @@ -1117,7 +1117,7 @@ function get_schema_struct() 'topic_time' => array('TIMESTAMP', 0), 'topic_time_limit' => array('TIMESTAMP', 0), 'topic_views' => array('UINT', 0), - 'topic_posts' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0), 'topic_status' => array('TINT:3', 0), diff --git a/phpBB/feed.php b/phpBB/feed.php index 74e9266b94..907109e02d 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -1075,7 +1075,7 @@ class phpbb_feed_forums extends phpbb_feed_base $this->sql = array( 'SELECT' => 'f.forum_id, f.left_id, f.forum_name, f.forum_last_post_time, f.forum_desc, f.forum_desc_bitfield, f.forum_desc_uid, f.forum_desc_options, - f.forum_topics, f.forum_posts', + f.forum_topics_approved, f.forum_posts_approved', 'FROM' => array(FORUMS_TABLE => 'f'), 'WHERE' => 'f.forum_type = ' . FORUM_POST . ' AND ' . $db->sql_in_set('f.forum_id', $in_fid_ary), @@ -1096,7 +1096,7 @@ class phpbb_feed_forums extends phpbb_feed_base global $user; $item_row['statistics'] = $user->lang('TOTAL_TOPICS', (int) $row['forum_topics']) - . ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts']); + . ' ' . $this->separator_stats . ' ' . $user->lang('TOTAL_POSTS_COUNT', (int) $row['forum_posts_approved']); } } } diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 8029181f39..bb91acba74 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -856,8 +856,8 @@ class acp_forums 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', 'FORUM_NAME' => $row['forum_name'], 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), - 'FORUM_TOPICS' => $row['forum_topics'], - 'FORUM_POSTS' => $row['forum_posts'], + 'FORUM_TOPICS' => $row['forum_topics_approved'], + 'FORUM_POSTS' => $row['forum_posts_approved'], 'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false, 'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false, @@ -1143,7 +1143,7 @@ class acp_forums return array($user->lang['NO_FORUM_ACTION']); } - $forum_data_sql['forum_posts'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0; + $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0; $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; } @@ -1264,10 +1264,10 @@ class acp_forums else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) { // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum) - $forum_data_sql['forum_posts'] = 0; + $forum_data_sql['forum_posts_approved'] = 0; $forum_data_sql['forum_posts_unapproved'] = 0; $forum_data_sql['forum_posts_softdeleted'] = 0; - $forum_data_sql['forum_topics'] = 0; + $forum_data_sql['forum_topics_approved'] = 0; $forum_data_sql['forum_topics_unapproved'] = 0; $forum_data_sql['forum_topics_softdeleted'] = 0; $forum_data_sql['forum_last_post_id'] = 0; diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index a1b7c16c2d..bea70571f9 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -60,10 +60,10 @@ class phpbb_content_visibility if (!$auth->acl_get('m_approve', $forum_id)) { - return (int) $data[$mode]; + return (int) $data[$mode . '_approved']; } - return (int) $data[$mode] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; + return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; } /** @@ -372,7 +372,7 @@ class phpbb_content_visibility { if ($cur_posts) { - $sql_ary['posts'] = ' - ' . $cur_posts; + $sql_ary['posts_approved'] = ' - ' . $cur_posts; } if ($cur_unapproved_posts) { @@ -395,7 +395,7 @@ class phpbb_content_visibility } if ($cur_softdeleted_posts + $cur_unapproved_posts) { - $sql_ary['posts'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts); + $sql_ary['posts_approved'] = ' + ' . ($cur_softdeleted_posts + $cur_unapproved_posts); } } @@ -564,7 +564,7 @@ class phpbb_content_visibility // Do we need to grab some topic informations? if (!sizeof($topic_row)) { - $sql = 'SELECT topic_type, topic_posts, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility + $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id; $result = $db->sql_query($sql); @@ -573,8 +573,8 @@ class phpbb_content_visibility } // If this is an edited topic or the first post the topic gets completely disapproved later on... - $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_topics = forum_topics - 1'; - $sql_data[FORUMS_TABLE] .= ', forum_posts = forum_posts - ' . $topic_row['topic_posts']; + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1'; + $sql_data[FORUMS_TABLE] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved']; $sql_data[FORUMS_TABLE] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved']; $sql_data[FORUMS_TABLE] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted']; diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index f1c3cf62b1..2bf36d967a 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1669,10 +1669,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $forum_data[$forum_id] = $row; if ($sync_extra) { - $forum_data[$forum_id]['posts'] = 0; + $forum_data[$forum_id]['posts_approved'] = 0; $forum_data[$forum_id]['posts_unapproved'] = 0; $forum_data[$forum_id]['posts_softdeleted'] = 0; - $forum_data[$forum_id]['topics'] = 0; + $forum_data[$forum_id]['topics_approved'] = 0; $forum_data[$forum_id]['topics_unapproved'] = 0; $forum_data[$forum_id]['topics_softdeleted'] = 0; } @@ -1746,7 +1746,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, { $forum_id = (sizeof($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; - $forum_data[$forum_id]['posts'] = (int) $row['forum_posts']; + $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts']; $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; $forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted']; } @@ -1829,7 +1829,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, if ($sync_extra) { - array_push($fieldnames, 'posts', 'posts_unapproved', 'posts_softdeleted', 'topics', 'topics_unapproved', 'topics_softdeleted'); + array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted'); } foreach ($forum_data as $forum_id => $row) @@ -1884,7 +1884,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $topic_id = (int) $row['topic_id']; $topic_data[$topic_id] = $row; $topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED; - $topic_data[$topic_id]['posts'] = 0; + $topic_data[$topic_id]['posts_approved'] = 0; $topic_data[$topic_id]['posts_unapproved'] = 0; $topic_data[$topic_id]['posts_softdeleted'] = 0; $topic_data[$topic_id]['first_post_id'] = 0; @@ -1930,7 +1930,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, if ($row['post_visibility'] == ITEM_APPROVED) { - $topic_data[$topic_id]['posts'] = $row['total_posts']; + $topic_data[$topic_id]['posts_approved'] = $row['total_posts']; } else if ($row['post_visibility'] == ITEM_UNAPPROVED) { @@ -2141,7 +2141,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, } // These are fields that will be synchronised - $fieldnames = array('time', 'visibility', 'posts', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + $fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); if ($sync_extra) { diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 8e8e3aac9f..62567e302a 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1418,7 +1418,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ // Specify our post mode $post_mode = 'delete'; - if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1)) + if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1)) { $post_mode = 'delete_topic'; } @@ -1718,7 +1718,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } else if ($mode == 'edit') { - $post_mode = ($data['topic_posts'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit')); + $post_mode = ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data['topic_first_post_id'] == $data['post_id']) ? 'edit_first_post' : (($data['topic_last_post_id'] == $data['post_id']) ? 'edit_last_post' : 'edit')); } // First of all make sure the subject and topic title are having the correct length. @@ -1879,8 +1879,9 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_last_view_time' => $current_time, 'forum_id' => $data['forum_id'], 'icon_id' => $data['icon_id'], - 'topic_posts' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, - 'topic_posts_softdeleted' => ($post_visibility != ITEM_APPROVED) ? 1 : 0, + 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, + 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0, + 'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0, 'topic_visibility' => $post_visibility, 'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0, 'topic_title' => $subject, diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 945b80ba41..aeaa37f4cb 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -494,7 +494,7 @@ function mcp_move_topic($topic_ids) $topics_moved_softdeleted++; } - $posts_moved += $topic_info['topic_posts']; + $posts_moved += $topic_info['topic_posts_approved']; $posts_moved_unapproved += $topic_info['topic_posts_unapproved']; $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted']; } @@ -534,7 +534,7 @@ function mcp_move_topic($topic_ids) 'topic_time' => (int) $row['topic_time'], 'topic_time_limit' => (int) $row['topic_time_limit'], 'topic_views' => (int) $row['topic_views'], - 'topic_posts' => (int) $row['topic_posts'], + 'topic_posts_approved' => (int) $row['topic_posts_approved'], 'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'], 'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'], 'topic_status' => ITEM_MOVED, @@ -1180,7 +1180,7 @@ function mcp_fork_topic($topic_ids) 'topic_title' => (string) $topic_row['topic_title'], 'topic_poster' => (int) $topic_row['topic_poster'], 'topic_time' => (int) $topic_row['topic_time'], - 'topic_posts' => (int) $topic_row['topic_posts'], + 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'], 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], 'topic_status' => (int) $topic_row['topic_status'], diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index b6a36f184a..ab2d5124af 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -932,7 +932,7 @@ class mcp_queue // If the count of disapproved posts for the topic is equal // to the number of unapproved posts in the topic, and there are no different // posts, we disapprove the hole topic - if ($topic_information[$topic_id]['topic_posts'] == 0 && + if ($topic_information[$topic_id]['topic_posts_approved'] == 0 && $topic_information[$topic_id]['topic_posts_softdeleted'] == 0 && $topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id]) { diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 9edfc9fd13..09373d87c2 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -495,7 +495,7 @@ if (!$get_info) array('topic_title', 'topics.topic_title', 'phpbb_set_encoding'), array('topic_time', 'topics.topic_time', ''), array('topic_views', 'topics.topic_views', ''), - array('topic_posts', 'topics.topic_replies + 1', ''), + array('topic_posts_approved', 'topics.topic_replies + 1', ''), array('topic_posts_unapproved', 0, ''), array('topic_posts_softdeleted',0, ''), array('topic_last_post_id', 'topics.topic_last_post_id', ''), diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index e2cbda3eeb..a698f0ef13 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -243,8 +243,10 @@ function phpbb_insert_forums() 'forum_rules_options' => 7, 'forum_rules_uid' => '', 'forum_topics_per_page' => 0, - 'forum_posts' => 0, - 'forum_topics' => 0, + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_posts_softdeleted' => 0, + 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0, diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7ae4335b64..8f87f84704 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1100,8 +1100,10 @@ function database_update_info() ), 'add_columns' => array( FORUMS_TABLE => array( + 'forum_posts_approved' => array('UINT', 0), 'forum_posts_unapproved' => array('UINT', 0), 'forum_posts_softdeleted' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), 'forum_topics_unapproved' => array('UINT', 0), 'forum_topics_softdeleted' => array('UINT', 0), ), @@ -1131,7 +1133,7 @@ function database_update_info() 'topic_delete_time' => array('TIMESTAMP', 0), 'topic_delete_reason' => array('STEXT_UNI', ''), 'topic_delete_user' => array('UINT', 0), - 'topic_posts' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), 'topic_posts_unapproved' => array('UINT', 0), 'topic_posts_softdeleted' => array('UINT', 0), ), @@ -2756,13 +2758,13 @@ function change_database_data(&$no_updates, $version) if ($db_tools->sql_column_exists(TOPICS_TABLE, 'topic_replies')) { $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_posts = topic_replies + 1, + SET topic_posts_approved = topic_replies + 1, topic_posts_unapproved = topic_replies_real - topic_replies WHERE topic_visibility = ' . ITEM_APPROVED; _sql($sql, $errored, $error_ary); $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_posts = 0, + SET topic_posts_approved = 0, topic_posts_unapproved = (topic_replies_real - topic_replies) + 1 WHERE topic_visibility = ' . ITEM_UNAPPROVED; _sql($sql, $errored, $error_ary); @@ -2779,17 +2781,17 @@ function change_database_data(&$no_updates, $version) if (!isset($update_forums[$forum_id])) { $update_forums[$forum_id] = array( - 'forum_posts' => 0, + 'forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, - 'forum_topics' => 0, + 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, ); } - $update_forums[$forum_id]['forum_posts'] += (int) $row['sum_posts']; + $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts']; $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; - $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; + $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; } $db->sql_freeresult($result); diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql index 87ad0c6480..331281562f 100644 --- a/phpBB/install/schemas/firebird_schema.sql +++ b/phpBB/install/schemas/firebird_schema.sql @@ -363,10 +363,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page INTEGER DEFAULT 0 NOT NULL, forum_type INTEGER DEFAULT 0 NOT NULL, forum_status INTEGER DEFAULT 0 NOT NULL, - forum_posts INTEGER DEFAULT 0 NOT NULL, + forum_posts_approved INTEGER DEFAULT 0 NOT NULL, forum_posts_unapproved INTEGER DEFAULT 0 NOT NULL, forum_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, - forum_topics INTEGER DEFAULT 0 NOT NULL, + forum_topics_approved INTEGER DEFAULT 0 NOT NULL, forum_topics_unapproved INTEGER DEFAULT 0 NOT NULL, forum_topics_softdeleted INTEGER DEFAULT 0 NOT NULL, forum_last_post_id INTEGER DEFAULT 0 NOT NULL, @@ -1128,7 +1128,7 @@ CREATE TABLE phpbb_topics ( topic_time INTEGER DEFAULT 0 NOT NULL, topic_time_limit INTEGER DEFAULT 0 NOT NULL, topic_views INTEGER DEFAULT 0 NOT NULL, - topic_posts INTEGER DEFAULT 0 NOT NULL, + topic_posts_approved INTEGER DEFAULT 0 NOT NULL, topic_posts_unapproved INTEGER DEFAULT 0 NOT NULL, topic_posts_softdeleted INTEGER DEFAULT 0 NOT NULL, topic_status INTEGER DEFAULT 0 NOT NULL, diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index c823533135..c3616803c9 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -442,10 +442,10 @@ CREATE TABLE [phpbb_forums] ( [forum_topics_per_page] [int] DEFAULT (0) NOT NULL , [forum_type] [int] DEFAULT (0) NOT NULL , [forum_status] [int] DEFAULT (0) NOT NULL , - [forum_posts] [int] DEFAULT (0) NOT NULL , + [forum_posts_approved] [int] DEFAULT (0) NOT NULL , [forum_posts_unapproved] [int] DEFAULT (0) NOT NULL , [forum_posts_softdeleted] [int] DEFAULT (0) NOT NULL , - [forum_topics] [int] DEFAULT (0) NOT NULL , + [forum_topics_approved] [int] DEFAULT (0) NOT NULL , [forum_topics_unapproved] [int] DEFAULT (0) NOT NULL , [forum_topics_softdeleted] [int] DEFAULT (0) NOT NULL , [forum_last_post_id] [int] DEFAULT (0) NOT NULL , @@ -1363,7 +1363,7 @@ CREATE TABLE [phpbb_topics] ( [topic_time] [int] DEFAULT (0) NOT NULL , [topic_time_limit] [int] DEFAULT (0) NOT NULL , [topic_views] [int] DEFAULT (0) NOT NULL , - [topic_posts] [int] DEFAULT (0) NOT NULL , + [topic_posts_approved] [int] DEFAULT (0) NOT NULL , [topic_posts_unapproved] [int] DEFAULT (0) NOT NULL , [topic_posts_softdeleted] [int] DEFAULT (0) NOT NULL , [topic_status] [int] DEFAULT (0) NOT NULL , diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql index b4545ed4ac..cdfc6b82c0 100644 --- a/phpBB/install/schemas/mysql_40_schema.sql +++ b/phpBB/install/schemas/mysql_40_schema.sql @@ -249,10 +249,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -790,7 +790,7 @@ CREATE TABLE phpbb_topics ( topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql index 9c53cab44e..633c8dbbc5 100644 --- a/phpBB/install/schemas/mysql_41_schema.sql +++ b/phpBB/install/schemas/mysql_41_schema.sql @@ -249,10 +249,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page tinyint(4) DEFAULT '0' NOT NULL, forum_type tinyint(4) DEFAULT '0' NOT NULL, forum_status tinyint(4) DEFAULT '0' NOT NULL, - forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + forum_topics_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_topics_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, forum_last_post_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -790,7 +790,7 @@ CREATE TABLE phpbb_topics ( topic_time int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_time_limit int(11) UNSIGNED DEFAULT '0' NOT NULL, topic_views mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, - topic_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, + topic_posts_approved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_unapproved mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_posts_softdeleted mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql index 3a4525734f..e757c9b69e 100644 --- a/phpBB/install/schemas/oracle_schema.sql +++ b/phpBB/install/schemas/oracle_schema.sql @@ -509,10 +509,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page number(4) DEFAULT '0' NOT NULL, forum_type number(4) DEFAULT '0' NOT NULL, forum_status number(4) DEFAULT '0' NOT NULL, - forum_posts number(8) DEFAULT '0' NOT NULL, + forum_posts_approved number(8) DEFAULT '0' NOT NULL, forum_posts_unapproved number(8) DEFAULT '0' NOT NULL, forum_posts_softdeleted number(8) DEFAULT '0' NOT NULL, - forum_topics number(8) DEFAULT '0' NOT NULL, + forum_topics_approved number(8) DEFAULT '0' NOT NULL, forum_topics_unapproved number(8) DEFAULT '0' NOT NULL, forum_topics_softdeleted number(8) DEFAULT '0' NOT NULL, forum_last_post_id number(8) DEFAULT '0' NOT NULL, @@ -1493,7 +1493,7 @@ CREATE TABLE phpbb_topics ( topic_time number(11) DEFAULT '0' NOT NULL, topic_time_limit number(11) DEFAULT '0' NOT NULL, topic_views number(8) DEFAULT '0' NOT NULL, - topic_posts number(8) DEFAULT '0' NOT NULL, + topic_posts_approved number(8) DEFAULT '0' NOT NULL, topic_posts_unapproved number(8) DEFAULT '0' NOT NULL, topic_posts_softdeleted number(8) DEFAULT '0' NOT NULL, topic_status number(3) DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql index a8289940a9..0235c25267 100644 --- a/phpBB/install/schemas/postgres_schema.sql +++ b/phpBB/install/schemas/postgres_schema.sql @@ -385,10 +385,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page INT2 DEFAULT '0' NOT NULL, forum_type INT2 DEFAULT '0' NOT NULL, forum_status INT2 DEFAULT '0' NOT NULL, - forum_posts INT4 DEFAULT '0' NOT NULL CHECK (forum_posts >= 0), + forum_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_approved >= 0), forum_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_unapproved >= 0), forum_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_posts_softdeleted >= 0), - forum_topics INT4 DEFAULT '0' NOT NULL CHECK (forum_topics >= 0), + forum_topics_approved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_approved >= 0), forum_topics_unapproved INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_unapproved >= 0), forum_topics_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (forum_topics_softdeleted >= 0), forum_last_post_id INT4 DEFAULT '0' NOT NULL CHECK (forum_last_post_id >= 0), @@ -1028,7 +1028,7 @@ CREATE TABLE phpbb_topics ( topic_time INT4 DEFAULT '0' NOT NULL CHECK (topic_time >= 0), topic_time_limit INT4 DEFAULT '0' NOT NULL CHECK (topic_time_limit >= 0), topic_views INT4 DEFAULT '0' NOT NULL CHECK (topic_views >= 0), - topic_posts INT4 DEFAULT '0' NOT NULL CHECK (topic_posts >= 0), + topic_posts_approved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_approved >= 0), topic_posts_unapproved INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_unapproved >= 0), topic_posts_softdeleted INT4 DEFAULT '0' NOT NULL CHECK (topic_posts_softdeleted >= 0), topic_status INT2 DEFAULT '0' NOT NULL, diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql index 83d0d032b3..bd4b98eaf4 100644 --- a/phpBB/install/schemas/sqlite_schema.sql +++ b/phpBB/install/schemas/sqlite_schema.sql @@ -242,10 +242,10 @@ CREATE TABLE phpbb_forums ( forum_topics_per_page tinyint(4) NOT NULL DEFAULT '0', forum_type tinyint(4) NOT NULL DEFAULT '0', forum_status tinyint(4) NOT NULL DEFAULT '0', - forum_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', - forum_topics INTEGER UNSIGNED NOT NULL DEFAULT '0', + forum_topics_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_topics_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', forum_last_post_id INTEGER UNSIGNED NOT NULL DEFAULT '0', @@ -765,7 +765,7 @@ CREATE TABLE phpbb_topics ( topic_time INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_time_limit INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_views INTEGER UNSIGNED NOT NULL DEFAULT '0', - topic_posts INTEGER UNSIGNED NOT NULL DEFAULT '0', + topic_posts_approved INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_unapproved INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_posts_softdeleted INTEGER UNSIGNED NOT NULL DEFAULT '0', topic_status tinyint(3) NOT NULL DEFAULT '0', diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 4c87838306..402f22b1ee 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -750,7 +750,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, $limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'tt' => $user->lang['TOPIC_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); - $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts'), 's' => 't.topic_title', 'v' => 't.topic_views'); + $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_post_time', 'tt' => 't.topic_time', 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 't.topic_title', 'v' => 't.topic_views'); $limit_time_sql = ($min_time) ? "AND t.topic_last_post_time >= $min_time" : ''; break; diff --git a/phpBB/posting.php b/phpBB/posting.php index 0b22fa54c2..52ef424ace 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -887,8 +887,8 @@ if ($submit || $preview || $refresh) if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id)) { - $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts']); - $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts']); + $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']); + $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']); $updated_post_data = phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post); if (!empty($updated_post_data)) @@ -1103,7 +1103,7 @@ if ($submit || $preview || $refresh) if ($mode == 'edit') { - $data['topic_posts'] = $post_data['topic_posts']; + $data['topic_posts_approved'] = $post_data['topic_posts_approved']; $data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved']; $data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted']; } @@ -1563,7 +1563,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof $data = array( 'topic_first_post_id' => $post_data['topic_first_post_id'], 'topic_last_post_id' => $post_data['topic_last_post_id'], - 'topic_posts' => $post_data['topic_posts'], + 'topic_posts_approved' => $post_data['topic_posts_approved'], 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], 'topic_visibility' => $post_data['topic_visibility'], -- cgit v1.2.1