From 977d0da9f3bac811793bffa7cf6b605599c9f871 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 11 May 2009 03:53:44 +0000 Subject: 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. --- modules/exif/helpers/exif_theme.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'modules/exif/helpers/exif_theme.php') 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; -- cgit v1.2.3