summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers/albums.php
diff options
context:
space:
mode:
authorJoe7 <jozsef.rnagy@site.hu>2011-01-03 13:21:54 +0100
committerBharat Mediratta <bharat@menalto.com>2011-01-03 11:01:02 -0800
commit336632fea0a955d74099cd169b3178c01f250ff5 (patch)
treeea4f7b41d735dc41bbeb6f073052a8215ecc42a0 /modules/gallery/controllers/albums.php
parente760200eeec2f003f95072118a6cc52971c76dad (diff)
Keep view counters of all item types accurate
Added common increment_view_count() func in item model for reuse
Diffstat (limited to 'modules/gallery/controllers/albums.php')
-rw-r--r--modules/gallery/controllers/albums.php5
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index b0887195..c0368488 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -71,10 +71,7 @@ class Albums_Controller extends Items_Controller {
$template->set_global("parents", $album->parents()->as_array()); // view calls empty() on this
$template->content = new View("album.html");
- // We can't use math in ORM or the query builder, so do this by hand. It's important
- // that we do this with math, otherwise concurrent accesses will damage accuracy.
- db::query("UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = $album->id")
- ->execute();
+ $album->increment_view_count();
print $template;
}