#!/usr/bin/env php . */ define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); $shortoptions = 'i::yv'; $longoptions = array('id=', 'yes', 'verbose'); $helptext = <<getFilename(); } catch (Exception $e) { $filename = '(remote file or no filename)'; } print "About to PERMANENTLY delete file ($filename) with id=={$file->id}) AND its related notices. Are you sure? [y/N] "; $response = fgets(STDIN); if (strtolower(trim($response)) != 'y') { print "Aborting.\n"; exit(0); } } print "Finding notices...\n"; try { $ids = File_to_post::getNoticeIDsByFile($file); $notice = Notice::multiGet('id', $ids); while ($notice->fetch()) { print "Deleting notice {$notice->id}".($verbose ? ": $notice->content\n" : "\n"); $notice->delete(); } } catch (NoResultException $e) { print "No notices found with this File attached.\n"; } print "Deleting File object together with possibly locally stored copy.\n"; $file->delete(); print "DONE.\n";