diff options
| author | Joas Schilling <nickvergessen@gmx.de> | 2012-10-16 14:20:23 +0200 |
|---|---|---|
| committer | Joas Schilling <nickvergessen@gmx.de> | 2012-10-16 14:20:23 +0200 |
| commit | 43d041bdecb5e564ad48efdf4702cad3714c7837 (patch) | |
| tree | 052505dab91a5298518e5a3d772c275deb67bd83 /phpBB/includes/content_visibility.php | |
| parent | 722835a4baad13e6886ffd724f92ffaf61990b90 (diff) | |
| download | forums-43d041bdecb5e564ad48efdf4702cad3714c7837.tar forums-43d041bdecb5e564ad48efdf4702cad3714c7837.tar.gz forums-43d041bdecb5e564ad48efdf4702cad3714c7837.tar.bz2 forums-43d041bdecb5e564ad48efdf4702cad3714c7837.tar.xz forums-43d041bdecb5e564ad48efdf4702cad3714c7837.zip | |
[feature/soft-delete] Removed unused old functions
PHPBB3-9567
Diffstat (limited to 'phpBB/includes/content_visibility.php')
| -rw-r--r-- | phpBB/includes/content_visibility.php | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/phpBB/includes/content_visibility.php b/phpBB/includes/content_visibility.php index 8854981303..8bfdfd2917 100644 --- a/phpBB/includes/content_visibility.php +++ b/phpBB/includes/content_visibility.php @@ -550,168 +550,4 @@ class phpbb_content_visibility $db->sql_query($sql); } } - - /** - * One function to rule them all... and unhide posts and topics. This could - * reasonably be broken up, I straight copied this code from the mcp_queue.php - * file here for global access. - * @param $mode - string - member of the set {'approve', 'restore'} - * @param $post_info - array - Contains info from post U topics table about - * the posts/topics in question - * @param $post_id_list - array of ints - the set of posts being worked on - */ - static public function unhide_posts_topics($mode, $post_info, $post_id_list) - { - global $db, $config; - - // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1 - // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1 - - $total_topics = $total_posts = 0; - $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array(); - $user_posts_sql = $post_approved_list = array(); - - foreach ($post_info as $post_id => $post_data) - { - if ($post_data['post_visibility'] == ITEM_APPROVED) - { - $post_approved_list[] = $post_id; - continue; - } - - $topic_id_list[$post_data['topic_id']] = 1; - - if ($post_data['forum_id']) - { - $forum_id_list[$post_data['forum_id']] = 1; - } - - // User post update (we do not care about topic or post, since user topics are strictly connected to posts) - // But we care about forums where post counts get not increased. ;) - if ($post_data['post_postcount']) - { - $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1; - } - - // Topic or Post. ;) - if ($post_data['topic_first_post_id'] == $post_id) - { - if ($post_data['forum_id']) - { - $total_topics++; - } - $topic_approve_sql[] = $post_data['topic_id']; - - $approve_log[] = array( - 'type' => 'topic', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => $post_data['topic_id'], - ); - } - else - { - $approve_log[] = array( - 'type' => 'post', - 'post_subject' => $post_data['post_subject'], - 'forum_id' => $post_data['forum_id'], - 'topic_id' => $post_data['topic_id'], - ); - } - - if ($post_data['forum_id']) - { - $total_posts++; - - // Increment by topic_replies if we approve a topic... - // This works because we do not adjust the topic_replies when re-approving a topic after an edit. - if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies']) - { - $total_posts += $post_data['topic_replies']; - } - } - - $post_approve_sql[] = $post_id; - } - - $post_id_list = array_values(array_diff($post_id_list, $post_approved_list)); - for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++) - { - unset($post_info[$post_approved_list[$i]]); - } - - if (sizeof($topic_approve_sql)) - { - $sql = 'UPDATE ' . TOPICS_TABLE . ' - SET topic_visibility = ' . ITEM_APPROVED . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); - $db->sql_query($sql); - } - - if (sizeof($post_approve_sql)) - { - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_visibility = ' . ITEM_APPROVED . ' - WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); - $db->sql_query($sql); - } - - unset($topic_approve_sql, $post_approve_sql); - - foreach ($approve_log as $log_data) - { - add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_' . strtoupper($mode) . 'D' : 'LOG_POST_' . strtoupper($mode) . 'D', $log_data['post_subject']); - } - - if (sizeof($user_posts_sql)) - { - // Try to minimize the query count by merging users with the same post count additions - $user_posts_update = array(); - - foreach ($user_posts_sql as $user_id => $user_posts) - { - $user_posts_update[$user_posts][] = $user_id; - } - - foreach ($user_posts_update as $user_posts => $user_id_ary) - { - $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_posts = user_posts + ' . $user_posts . ' - WHERE ' . $db->sql_in_set('user_id', $user_id_ary); - $db->sql_query($sql); - } - } - - if ($total_topics) - { - set_config_count('num_topics', $total_topics, true); - } - - if ($total_posts) - { - set_config_count('num_posts', $total_posts, true); - } - - if (!function_exists('sync')) - { - global $phpbb_root_path, $phpEx; - include ($phpbb_root_path . 'includes/functions_admin.'.$phpEx); - } - - sync('topic', 'topic_id', array_keys($topic_id_list), true); - sync('forum', 'forum_id', array_keys($forum_id_list), true, true); - unset($topic_id_list, $forum_id_list); - - if ($total_topics) - { - //@todo: plurals! - $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS'; - } - else - { - $success_msg = (sizeof($post_id_list) + sizeof($post_approved_list) == 1) ? 'POST_APPROVED_SUCCESS' : 'POSTS_APPROVED_SUCCESS'; - } - - return $success_msg; - } } |
