Correctly update board statistics for attaching orphaned files to existing posts (Bug #20185)

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8451 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2008-03-18 14:44:51 +00:00
parent c6c2d325bf
commit b0bfd5c66f
2 changed files with 11 additions and 0 deletions

View file

@ -142,6 +142,7 @@
<li>[Fix] Allow &amp; and | in local part of email addresses (Bug #22995)</li> <li>[Fix] Allow &amp; and | in local part of email addresses (Bug #22995)</li>
<li>[Fix] Do not error out if php_uname function disabled / Authenticating on SMTP Server (Bug #22235 - patch by HoL)</li> <li>[Fix] Do not error out if php_uname function disabled / Authenticating on SMTP Server (Bug #22235 - patch by HoL)</li>
<li>[Fix] Correctly obtain to be ignored users within topic/forum notification (Bug #21795 - patch provided by dr.death)</li> <li>[Fix] Correctly obtain to be ignored users within topic/forum notification (Bug #21795 - patch provided by dr.death)</li>
<li>[Fix] Correctly update board statistics for attaching orphaned files to existing posts (Bug #20185)</li>
</ul> </ul>

View file

@ -940,6 +940,7 @@ class acp_attachments
AND is_orphan = 1'; AND is_orphan = 1';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$files_added = $space_taken = 0;
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$post_row = $post_info[$upload_list[$row['attach_id']]]; $post_row = $post_info[$upload_list[$row['attach_id']]];
@ -979,9 +980,18 @@ class acp_attachments
WHERE topic_id = ' . $post_row['topic_id']; WHERE topic_id = ' . $post_row['topic_id'];
$db->sql_query($sql); $db->sql_query($sql);
$space_taken += $row['filesize'];
$files_added++;
add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']); add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']);
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
if ($files_added)
{
set_config('upload_dir_size', $config['upload_dir_size'] + $space_taken, true);
set_config('num_files', $config['num_files'] + $files_added, true);
}
} }
} }