From 98ebe1f63b9495ee8bf9c6d533ecf8fabbc3a801 Mon Sep 17 00:00:00 2001 From: Diogo Cordeiro Date: Wed, 17 Apr 2019 02:00:12 +0100 Subject: [PATCH] [StoreRemoteMedia] script removeRemoteMedia.php was deleting every file posted without being via web interface Added two more options: delete image-only attachments; delete previews (like oembed thumbs) Some further minor improvements. Thanks to colegota for spotting this issue. --- .../scripts/removeRemoteMedia.php | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/plugins/StoreRemoteMedia/scripts/removeRemoteMedia.php b/plugins/StoreRemoteMedia/scripts/removeRemoteMedia.php index 8b94ac04c4..b3b43018a9 100755 --- a/plugins/StoreRemoteMedia/scripts/removeRemoteMedia.php +++ b/plugins/StoreRemoteMedia/scripts/removeRemoteMedia.php @@ -29,29 +29,39 @@ define('INSTALLDIR', realpath(__DIR__ . '/../../..')); -$longoptions = ['limit=']; +$shortoptions = 'l::a::i'; +$longoptions = ['limit=','all','image']; $helptext = << 'web' - AND notice.modified <= '{$max_date}' - ORDER BY notice.modified ASC -"; + notice.is_local = 0 "; + +$query .= $image_only ? " AND file.width IS NOT NULL AND file.height IS NOT NULL " : ""; + +$query .= $include_previews ? "" : " AND file.filehash IS NOT NULL "; +$query .= " AND notice.modified <= '{$max_date}' ORDER BY notice.modified ASC"; $fn = new DB_DataObject(); $fn->query($query); -- 2.39.5