diff --git a/scripts/delete_orphan_files.php b/scripts/delete_orphan_files.php new file mode 100755 index 0000000000..ad575187bd --- /dev/null +++ b/scripts/delete_orphan_files.php @@ -0,0 +1,66 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'y'; +$longoptions = array('yes'); + +$helptext = <<query($sql) !== false) { + print " Deleting {$file->N} entries: "; + while ($file->fetch()) { + try { + $file->getPath(); + $file->delete(); + print 'x'; + } catch (Exception $e) { + // either FileNotFound exception or ClientException + $file->delete(); + print '.'; + } + } +} +print "\nDONE.\n";