diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 03:53:44 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-05-11 03:53:44 +0000 |
commit | 977d0da9f3bac811793bffa7cf6b605599c9f871 (patch) | |
tree | 9dc028c3c0305d9747e12f655c45b4e2f985e67d /modules/exif/helpers/exif_theme.php | |
parent | b706cb69ac7737a550c8f7fff025a6abeb3cfcb6 (diff) |
Refactor the exif module to denormalize the stored data. This way we
have a single exif_record for each item instead of 1 per key. It's
about 5x faster to scan photos this way.
Diffstat (limited to 'modules/exif/helpers/exif_theme.php')
-rw-r--r-- | modules/exif/helpers/exif_theme.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/exif/helpers/exif_theme.php b/modules/exif/helpers/exif_theme.php index 432bca40..0bd113ca 100644 --- a/modules/exif/helpers/exif_theme.php +++ b/modules/exif/helpers/exif_theme.php @@ -21,10 +21,13 @@ class exif_theme_Core { static function sidebar_bottom($theme) { $item = $theme->item(); if ($item && $item->is_photo()) { - $exif_count = Database::instance() - ->count_records("exif_keys", array("item_id" => $item->id)); - - if (!empty($exif_count)) { + if (Database::instance() + ->select("key_count") + ->from("exif_records") + ->where("item_id", $item->id) + ->get() + ->current() + ->key_count) { $view = new View("exif_sidebar.html"); $view->item = $item; return $view; |