JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
use sensible paths for config, wfpl, etc
[wfpl-cms.git] / admin_files.php
index 56db7ca..034cfdf 100644 (file)
@@ -93,8 +93,14 @@ function admin_files_main() {
 }
 
 function admin_files_main_delete($id) {
-       db_delete('files', 'where id=%i', $id);
-       message('File deleted.');
+       $fn = db_get_value('files', 'filename', 'where id=%i', $id);
+       if ($fn) {
+               unlink($fn);
+               db_delete('files', 'where id=%i', $id);
+               message('File deleted.');
+       } else {
+               message("Couldn't find file to delete. Maybe it's already been deleted?");
+       }
        return './admin_files';
 }