aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-03-19 17:01:59 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-03-19 17:01:59 +0000
commite461162847b1ac9287870de680e8dbd17e9f2fc1 (patch)
treee93351f9856ea56167c7c40a5c765318184df5d9 /phpBB/includes/functions_posting.php
parentbcabff8a1fe82452366b6f278782fd284effece4 (diff)
downloadforums-e461162847b1ac9287870de680e8dbd17e9f2fc1.tar
forums-e461162847b1ac9287870de680e8dbd17e9f2fc1.tar.gz
forums-e461162847b1ac9287870de680e8dbd17e9f2fc1.tar.bz2
forums-e461162847b1ac9287870de680e8dbd17e9f2fc1.tar.xz
forums-e461162847b1ac9287870de680e8dbd17e9f2fc1.zip
Fix race condition for updating post/topic/etc. counter. (reported by BartVB)
please do not try such fixes at home - the correct solution would be to create a second config table with integer columns. ;) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9398 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 8ec82d4f16..e44454b5ff 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1849,8 +1849,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1';
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1);
- set_config('num_topics', $config['num_topics'] - 1, true);
- set_config('num_posts', $config['num_posts'] - ($topic_row['topic_replies'] + 1), true);
+ set_config_count('num_topics', -1, true);
+ set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true);
// Only decrement this post, since this is the one non-approved now
if ($auth->acl_get('f_postcount', $data['forum_id']))
@@ -1870,7 +1870,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1';
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
- set_config('num_posts', $config['num_posts'] - 1, true);
+ set_config_count('num_posts', -1, true);
if ($auth->acl_get('f_postcount', $data['forum_id']))
{
@@ -2137,8 +2137,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
if ($space_taken && $files_added)
{
- set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
- set_config('num_files', $config['num_files'] + $files_added, true);
+ set_config_count('upload_dir_size', $space_taken, true);
+ set_config_count('num_files', $files_added, true);
}
}
@@ -2371,13 +2371,13 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
if ($post_mode == 'post')
{
- set_config('num_topics', $config['num_topics'] + 1, true);
- set_config('num_posts', $config['num_posts'] + 1, true);
+ set_config_count('num_topics', 1, true);
+ set_config_count('num_posts', 1, true);
}
if ($post_mode == 'reply')
{
- set_config('num_posts', $config['num_posts'] + 1, true);
+ set_config_count('num_posts', 1, true);
}
}