mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-08-07 17:23:04 +02:00
Physical duplicate files in Admin Advanced Functions
git-svn-id: http://piwigo.org/svn/trunk@1688 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+27
-2
@@ -137,7 +137,7 @@ SELECT element_id
|
||||
}
|
||||
else if ('not_linked' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = 'elements not linked to any virtual categories';
|
||||
$page['title'] = l10n('Elements_not_linked');
|
||||
|
||||
// we are searching elements not linked to any virtual category
|
||||
$query = '
|
||||
@@ -162,7 +162,32 @@ SELECT DISTINCT(image_id)
|
||||
|
||||
$page['cat_elements_id'] = array_diff($all_elements, $linked_to_virtual);
|
||||
}
|
||||
else if ('duplicates' == $_GET['cat'])
|
||||
{
|
||||
$page['title'] = l10n('Duplicates');
|
||||
|
||||
// we are searching related elements twice or more to physical categories
|
||||
// 1 - Retrieve Files
|
||||
$query = '
|
||||
SELECT DISTINCT(file)
|
||||
FROM '.IMAGES_TABLE.'
|
||||
GROUP BY file
|
||||
HAVING COUNT(DISTINCT storage_category_id) > 1
|
||||
;';
|
||||
|
||||
$duplicate_files = array_from_query($query, 'file');
|
||||
$duplicate_files[]='Nofiles';
|
||||
// 2 - Retrives related picture ids
|
||||
$query = '
|
||||
SELECT id, file
|
||||
FROM '.IMAGES_TABLE.'
|
||||
WHERE file IN (\''.implode("','", $duplicate_files).'\')
|
||||
ORDER BY file, id
|
||||
;';
|
||||
|
||||
$page['cat_elements_id'] = array_from_query($query, 'id');
|
||||
$page['cat_elements_id'][] = 0;
|
||||
}
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | first element to display |
|
||||
// +-----------------------------------------------------------------------+
|
||||
@@ -202,4 +227,4 @@ switch ($_GET['mode'])
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user