diff options
author | Fyorl <gaelreth@gmail.com> | 2012-08-04 14:48:07 +0100 |
---|---|---|
committer | Fyorl <gaelreth@gmail.com> | 2012-08-04 14:48:07 +0100 |
commit | ed1435d04093132b751e940937e7f4f4b0687031 (patch) | |
tree | ffeff9b63a18eaa9b8262b16794ba0390a2ceeb8 /phpBB/includes | |
parent | 20a2ceccbdbb47229750735bfcdf2a5d05353d95 (diff) | |
download | forums-ed1435d04093132b751e940937e7f4f4b0687031.tar forums-ed1435d04093132b751e940937e7f4f4b0687031.tar.gz forums-ed1435d04093132b751e940937e7f4f4b0687031.tar.bz2 forums-ed1435d04093132b751e940937e7f4f4b0687031.tar.xz forums-ed1435d04093132b751e940937e7f4f4b0687031.zip |
[feature/attach-dl] Added function for incrementing download counter
PHPBB3-11042
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_download.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 1486113013..b01712357d 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -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); +} |