1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-06 08:47:45 +02:00

[feature/attach-dl] Added function for incrementing download counter

PHPBB3-11042
This commit is contained in:
Fyorl
2012-08-04 14:48:07 +01:00
parent 20a2ceccbd
commit ed1435d040
2 changed files with 23 additions and 8 deletions

View File

@@ -592,3 +592,24 @@ function phpbb_parse_range_request($request_array, $filesize)
);
}
}
/**
* Increments the download count of all provided attachments
*
* @param dbal $db The database object
* @param array|int $ids The attach_id of each attachment
*
* @return null
*/
function phpbb_increment_downloads($db, $ids)
{
if (!is_array($ids))
{
$ids = array($ids);
}
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
SET download_count = download_count + 1
WHERE ' . $db->sql_in_set('attach_id', $ids);
$db->sql_query($sql);
}