[StoreRemoteMedia] script removeRemoteMedia.php was trying to remove already removed files

Sometimes different posts are associated with the same file, that case wasn't considered
Thanks to XRevan86 for spotting this issue.
This commit is contained in:
Diogo Cordeiro 2019-04-18 01:03:09 +01:00
parent 98ebe1f63b
commit 2d20656e22

View File

@ -30,7 +30,7 @@
define('INSTALLDIR', realpath(__DIR__ . '/../../..')); define('INSTALLDIR', realpath(__DIR__ . '/../../..'));
$shortoptions = 'l::a::i'; $shortoptions = 'l::a::i';
$longoptions = ['limit=','all','image']; $longoptions = ['limit=', 'all', 'image'];
$helptext = <<<END_OF_HELP $helptext = <<<END_OF_HELP
remove_remote_media.php [options] remove_remote_media.php [options]
@ -43,7 +43,7 @@ In case the attachment is an image its thumbs will be removed as well.
END_OF_HELP; END_OF_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc'; require_once INSTALLDIR . '/scripts/commandline.inc';
$quiet = have_option('q', 'quiet'); $quiet = have_option('q', 'quiet');
$include_previews = have_option('a', 'all'); $include_previews = have_option('a', 'all');
@ -61,7 +61,7 @@ if (empty($max_date)) {
} }
$query = " $query = "
SELECT SELECT DISTINCT
file_to_post.file_id file_to_post.file_id
FROM FROM
file_to_post file_to_post