diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-01-13 11:22:50 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-01-13 11:22:50 +0100 |
commit | 8ef84e2aa74bdc280b6a450a553d71ba492a01cc (patch) | |
tree | 4d22243099613b40eb3c354de4701db3c14927fd /include/photos.php | |
parent | bb0f3afb71add9dd8bf5cf160d1d2708a32f1119 (diff) | |
download | volse-hubzilla-8ef84e2aa74bdc280b6a450a553d71ba492a01cc.tar.gz volse-hubzilla-8ef84e2aa74bdc280b6a450a553d71ba492a01cc.tar.bz2 volse-hubzilla-8ef84e2aa74bdc280b6a450a553d71ba492a01cc.zip |
possibly improve the album list query and save the result in App::$data
Diffstat (limited to 'include/photos.php')
-rw-r--r-- | include/photos.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/photos.php b/include/photos.php index 8496c2c86..7ddbe43b9 100644 --- a/include/photos.php +++ b/include/photos.php @@ -464,10 +464,15 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction $sort_key = dbesc($sort_key); $direction = dbesc($direction); - $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction", - intval($channel_id), - intval(PHOTO_NORMAL), - intval(PHOTO_PROFILE) + //$albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and photo_usage IN ( %d, %d ) $sql_extra group by album order by $sort_key $direction", + // intval($channel_id), + // intval(PHOTO_NORMAL), + // intval(PHOTO_PROFILE) + //); + + // this query provides the same results but might perform better + $albums = q("SELECT count( distinct resource_id ) as total, album from photo where uid = %d and os_storage = 1 $sql_extra group by album order by $sort_key $direction", + intval($channel_id) ); // add various encodings to the array so we can just loop through and pick them out in a template @@ -490,6 +495,8 @@ function photos_albums_list($channel, $observer, $sort_key = 'album', $direction } } + App::$data['albums'] = $ret; + return $ret; } |