diff --git a/scripts/clean_thumbnails.php b/scripts/clean_thumbnails.php new file mode 100755 index 0000000000..aef3f54aff --- /dev/null +++ b/scripts/clean_thumbnails.php @@ -0,0 +1,66 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'y'; +$longoptions = array('yes'); + +$helptext = <<find(); +while ($thumbs->fetch()) { + try { + $file = $thumbs->getFile(); + if ($file->isLocal()) { + // only delete properly linked thumbnails if they're local + $thumbs->delete(); + print '.'; + } + } catch (NoResultException $e) { + // No File object for thumbnail, let's delete the thumbnail entry + $thumbs->delete(); + print 'x'; + } +} +print "\nDONE.\n";