Skip to content

Commit

Permalink
bug 1638 fixed: the "admin>tools>maintenance>unlinked elements" featu…
Browse files Browse the repository at this point in the history
…res 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
  • Loading branch information
plegall committed May 2, 2010
1 parent 5cdddc2 commit e803366
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions admin/element_set.php
Expand Up @@ -138,30 +138,31 @@
$template->assign(array('U_ACTIVE_MENU' => 5 ));

// 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'])
{
Expand Down

0 comments on commit e803366

Please sign in to comment.