diff options
author | Geolim4 <contact@geolim4.com> | 2014-08-08 13:35:08 +0200 |
---|---|---|
committer | Geolim4 <contact@geolim4.com> | 2014-08-08 17:07:16 +0200 |
commit | af67bd3ea52ee59324e9446665b5bdbe79158f32 (patch) | |
tree | 4a673b08a97975f8b2523fd2e65c702b7b66caed | |
parent | fc1e420a7c1b094b4a84aecef7fdbc8652af3027 (diff) | |
download | forums-af67bd3ea52ee59324e9446665b5bdbe79158f32.tar forums-af67bd3ea52ee59324e9446665b5bdbe79158f32.tar.gz forums-af67bd3ea52ee59324e9446665b5bdbe79158f32.tar.bz2 forums-af67bd3ea52ee59324e9446665b5bdbe79158f32.tar.xz forums-af67bd3ea52ee59324e9446665b5bdbe79158f32.zip |
[ticket/11520] Coding guideline compliance
PHPBB3-11520
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index bb466ec976..25d3e7380f 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1309,14 +1309,13 @@ function mcp_fork_topic($topic_ids) 'post_edit_locked' => (int) $row['post_edit_locked'], 'post_postcount' => $row['post_postcount'], ); - // Adjust post counts... only if the post can be incremented to the user counter (else, it was not added the users post count anyway) - //Fixed an error of phpBB: http://tracker.phpbb.com/browse/PHPBB3-11520 - //Do not do the query here but later, we just increment the count of posts until the loop is finished, then do new posts counters. + // Adjust post count only if the post can be incremented to the user counter else, it was not added the users post count anyway + // Do not do the query here but later, we just increment the count of posts until the loop is finished, then do new posts counters. if ($row['post_postcount']) { if (isset($counter[$row['poster_id']])) { - $counter[$row['poster_id']]++; + ++$counter[$row['poster_id']]; } else { @@ -1442,14 +1441,14 @@ function mcp_fork_topic($topic_ids) WHERE forum_id = ' . $to_forum_id; $db->sql_query($sql); - if (sizeof($counter)) + if (!empty($counter)) { - //Do only one query per user and not a query PER post!! - foreach ($counter AS $uid => $count) + // Do only one query per user and not a query per post. + foreach ($counter as $user_id => $count) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + ' . (int) $count . ' - WHERE user_id = ' . (int) $uid; + WHERE user_id = ' . (int) $user_id; $db->sql_query($sql); } } |