aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_search.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-01-17 21:16:42 +0000
committerrvelices <rv-github@modusoptimus.com>2011-01-17 21:16:42 +0000
commite123585dde33f8ec3be13e788eea6fc10041920f (patch)
treea6857b12bdc8e83c060c5166ebf07fe932f8c745 /include/functions_search.inc.php
parentb5046a4f949435ffbf068884f97cce300bf5ee90 (diff)
bug 2105 : Browsing tags is slow if tags contains many photos
git-svn-id: http://piwigo.org/svn/trunk@8726 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/functions_search.inc.php26
1 files changed, 1 insertions, 25 deletions
diff --git a/include/functions_search.inc.php b/include/functions_search.inc.php
index a8b005517..08cd675a2 100644
--- a/include/functions_search.inc.php
+++ b/include/functions_search.inc.php
@@ -231,23 +231,18 @@ SELECT DISTINCT(id)
{
$query .= "\n AND ".$images_where;
}
- if (empty($tag_items) or $search['mode']=='AND')
- { // directly use forbidden and order by
- $query .= $forbidden.'
+ $query .= $forbidden.'
'.$conf['order_by'];
- }
$items = array_from_query($query, 'id');
}
if ( !empty($tag_items) )
{
- $need_permission_check = false;
switch ($search['mode'])
{
case 'AND':
if (empty($search_clause))
{
- $need_permission_check = true;
$items = $tag_items;
}
else
@@ -263,27 +258,8 @@ SELECT DISTINCT(id)
$tag_items
)
);
- if ( $before_count < count($items) )
- {
- $need_permission_check = true;
- }
break;
}
- if ($need_permission_check and count($items) )
- {
- $query = '
-SELECT DISTINCT(id)
- FROM '.IMAGES_TABLE.' i
- INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id
- WHERE id IN ('.implode(',', $items).') '.$forbidden;
- if (!empty($images_where))
- {
- $query .= "\n AND ".$images_where;
- }
- $query .= '
- '.$conf['order_by'];
- $items = array_from_query($query, 'id');
- }
}
return $items;