From: Diogo Cordeiro Date: Wed, 17 Apr 2019 01:00:12 +0000 (+0100) Subject: [StoreRemoteMedia] script removeRemoteMedia.php was deleting every file posted withou... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=98ebe1f63b9495ee8bf9c6d533ecf8fabbc3a801;p=quix0rs-gnu-social.git [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. --- 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);