only select files with tag cache empty or obsolete

This commit is contained in:
Vincent Riquer 2013-03-05 13:24:06 +01:00
parent b171104c52
commit db3a30e54d

17
atom
View File

@ -763,32 +763,39 @@ removeObsoleteFiles
# get files # get files
echo ' echo '
SELECT COUNT(*) SELECT COUNT(DISTINCT source_files.filename)
FROM source_files, FROM source_files,
destinations, destinations,
destination_files, destination_files,
mime_type_actions mime_type_actions,
tags
WHERE destination_files.last_change < source_files.last_change WHERE destination_files.last_change < source_files.last_change
AND destinations.id = destination_files.destination_id AND destinations.id = destination_files.destination_id
AND mime_type_actions.destination_id = destinations.id AND mime_type_actions.destination_id = destinations.id
AND mime_type_actions.id = source_files.mime_type AND mime_type_actions.id = source_files.mime_type
AND source_files.id = destination_files.source_file_id AND source_files.id = destination_files.source_file_id
AND source_files.id = tags.source_file
AND tags.last_change < source_files.last_change
AND mime_type_actions.action = 1;' >&3 AND mime_type_actions.action = 1;' >&3
read -u4 filecount read -u4 filecount
echo ' echo '
SELECT SELECT DISTINCT
destinations.name, source_files.id,
source_files.last_change,
mime_type_actions.mime_text, mime_type_actions.mime_text,
source_files.filename source_files.filename
FROM source_files, FROM source_files,
destinations, destinations,
destination_files, destination_files,
mime_type_actions mime_type_actions,
tags
WHERE destination_files.last_change < source_files.last_change WHERE destination_files.last_change < source_files.last_change
AND destinations.id = destination_files.destination_id AND destinations.id = destination_files.destination_id
AND mime_type_actions.destination_id = destinations.id AND mime_type_actions.destination_id = destinations.id
AND mime_type_actions.id = source_files.mime_type AND mime_type_actions.id = source_files.mime_type
AND source_files.id = destination_files.source_file_id AND source_files.id = destination_files.source_file_id
AND source_files.id = tags.source_file
AND tags.last_change < source_files.last_change
AND mime_type_actions.action = 1; AND mime_type_actions.action = 1;
SELECT "AtOM:NoMoreFiles";' >&3 SELECT "AtOM:NoMoreFiles";' >&3