diff options
author | plegall <plg@piwigo.org> | 2010-05-02 22:06:39 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-05-02 22:06:39 +0000 |
commit | e803366a57cd7e3784609f4f6c1ec23a0408d3e2 (patch) | |
tree | 2804fa81648e2acebd9118ff6f6db3127c2f7ba5 /admin | |
parent | 5cdddc2b5323c97649ce07c34e7b5f81b3093fb3 (diff) |
bug 1638 fixed: the "admin>tools>maintenance>unlinked elements" features now
works if you have only virtual categories, this is what happens if you don't
use synchronization to add photos (if you use pLoader or UploadForm for
example).
git-svn-id: http://piwigo.org/svn/trunk@6048 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin')
-rw-r--r-- | admin/element_set.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/admin/element_set.php b/admin/element_set.php index 15c5d0f25..c19272084 100644 --- a/admin/element_set.php +++ b/admin/element_set.php @@ -140,28 +140,29 @@ else if ('not_linked' == $_GET['cat']) // we are searching elements not linked to any virtual category $query = ' SELECT id + FROM '.IMAGES_TABLE.' +;'; + $all_elements = array_from_query($query, 'id'); + + $linked_to_virtual = array(); + + $query = ' +SELECT id FROM '.CATEGORIES_TABLE.' WHERE dir IS NULL ;'; $virtual_categories = array_from_query($query, 'id'); - if (!empty($virtual_categories)) { $query = ' SELECT DISTINCT(image_id) FROM '.IMAGE_CATEGORY_TABLE.' -;'; - $all_elements = array_from_query($query, 'image_id'); - - $query = ' -SELECT DISTINCT(image_id) - FROM '.IMAGE_CATEGORY_TABLE.' WHERE category_id IN ('.implode(',', $virtual_categories).') ;'; $linked_to_virtual = array_from_query($query, 'image_id'); - - $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual); } + + $page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual); } else if ('duplicates' == $_GET['cat']) { |