diff options
author | rvelices <rv-github@modusoptimus.com> | 2014-02-11 21:47:44 +0000 |
---|---|---|
committer | rvelices <rv-github@modusoptimus.com> | 2014-02-11 21:47:44 +0000 |
commit | 2d9887993cc2c5dbbc22106c07906220bf33836f (patch) | |
tree | c9b07b57c5ab93d8be9356105e317c051267e8c4 /include/category_cats.inc.php | |
parent | 78621a34878093fe2fed7bcf76ac61aca9acb249 (diff) |
arrayfromquery optimizations: move double if from inside loop to outside + use directly mysqli calls to avoid function call overhead for every row retrieved from db
git-svn-id: http://piwigo.org/svn/trunk@27336 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/category_cats.inc.php')
-rw-r--r-- | include/category_cats.inc.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php index bb048297f..839a86c8f 100644 --- a/include/category_cats.inc.php +++ b/include/category_cats.inc.php @@ -133,14 +133,13 @@ SELECT representative_picture_id if ($conf['display_fromto']) { - $dates_of_category = array(); if (count($category_ids) > 0) { $query = ' SELECT category_id, - MIN(date_creation) AS date_creation_min, - MAX(date_creation) AS date_creation_max + MIN(date_creation) AS `from`, + MAX(date_creation) AS `to` FROM '.IMAGE_CATEGORY_TABLE.' INNER JOIN '.IMAGES_TABLE.' ON image_id = id WHERE category_id IN ('.implode(',', $category_ids).') @@ -155,14 +154,7 @@ SELECT ).' GROUP BY category_id ;'; - $result = pwg_query($query); - while ($row = pwg_db_fetch_assoc($result)) - { - $dates_of_category[ $row['category_id'] ] = array( - 'from' => $row['date_creation_min'], - 'to' => $row['date_creation_max'], - ); - } + $dates_of_category = query2array($query, 'category_id'); } } |