From 0d577584c357c5075d34fb00833ef44f2ce03649 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Tue, 24 Feb 2015 19:29:28 +0100 Subject: [PATCH] Script to delete file table entries which have disappeared locally --- scripts/clean_file_table.php | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 scripts/clean_file_table.php diff --git a/scripts/clean_file_table.php b/scripts/clean_file_table.php new file mode 100755 index 0000000000..573abf1ed0 --- /dev/null +++ b/scripts/clean_file_table.php @@ -0,0 +1,62 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'y'; +$longoptions = array('yes'); + +$helptext = <<whereAdd('filename IS NOT NULL'); // local files +$file->whereAdd('filehash IS NULL', 'AND'); // without filehash value +if ($file->find()) { + while ($file->fetch()) { + try { + $file->getPath(); + print '.'; + } catch (FileNotFoundException $e) { + $file->delete(); + print 'x'; + } + } +} +print "\nDONE.\n"; -- 2.39.5