mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
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
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user