mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
Merge pull request #6789 from rxu/ticket/17475
[ticket/17475] Fix MSSQL arithmetic overflow error on counting attachments size
This commit is contained in:
commit
40608777f0
4 changed files with 4 additions and 4 deletions
|
@ -1077,7 +1077,7 @@ class acp_attachments
|
|||
$attachments_per_page = (int) $config['topics_per_page'];
|
||||
|
||||
// Get total number or orphans older than 3 hours
|
||||
$sql = 'SELECT COUNT(attach_id) as num_files, SUM(filesize) as total_size
|
||||
$sql = 'SELECT COUNT(attach_id) as num_files, SUM(' . $this->db->cast_expr_to_bigint('filesize') . ') as total_size
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE is_orphan = 1
|
||||
AND filetime < ' . (time() - 3*60*60);
|
||||
|
|
|
@ -2071,7 +2071,7 @@ class acp_forums
|
|||
|
||||
$config->set('num_files', (int) $row['stat'], false);
|
||||
|
||||
$sql = 'SELECT SUM(filesize) as stat
|
||||
$sql = 'SELECT SUM(' . $db->cast_expr_to_bigint('filesize') . ') as stat
|
||||
FROM ' . ATTACHMENTS_TABLE;
|
||||
$result = $db->sql_query($sql);
|
||||
$row = $db->sql_fetchrow($result);
|
||||
|
|
|
@ -182,7 +182,7 @@ class acp_main
|
|||
$config->set('num_files', (int) $db->sql_fetchfield('stat'), false);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT SUM(filesize) as stat
|
||||
$sql = 'SELECT SUM(' . $db->cast_expr_to_bigint('filesize') . ') as stat
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE is_orphan = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
|
|
@ -1998,7 +1998,7 @@ function update_dynamic_config()
|
|||
$config->set('num_files', (int) $db->sql_fetchfield('stat'), false);
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$sql = 'SELECT SUM(filesize) as stat
|
||||
$sql = 'SELECT SUM(' . $db->cast_expr_to_bigint('filesize') . ') as stat
|
||||
FROM ' . ATTACHMENTS_TABLE . '
|
||||
WHERE is_orphan = 0';
|
||||
$result = $db->sql_query($sql);
|
||||
|
|
Loading…
Add table
Reference in a new issue