diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-06 15:31:48 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-06 15:31:48 +0000 |
commit | 3ffae10598ad4f983846a834aef12a29dee53903 (patch) | |
tree | 97035b185be6302bf73a367df2d21647c5e68e68 /modules/upload | |
parent | c3fcbcad679dc7621eb60fdeff67527f18caa539 (diff) | |
download | brdo-3ffae10598ad4f983846a834aef12a29dee53903.tar.gz brdo-3ffae10598ad4f983846a834aef12a29dee53903.tar.bz2 |
#173305 by drewish: actually remove files when the delete check box is checked
Diffstat (limited to 'modules/upload')
-rw-r--r-- | modules/upload/upload.module | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 3bcdf5ee4..becab2228 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -391,6 +391,14 @@ function upload_save(&$node) { // will be required. if (!empty($file->remove)) { db_query('DELETE FROM {upload} WHERE fid = %d AND vid = %d', $fid, $node->vid); + + // If the file isn't used by any other revisions delete it. + $count = db_result(db_query('SELECT COUNT(fid) FROM {upload} WHERE fid = %d', $fid)); + if ($count < 1) { + file_delete($file->filepath); + db_query('DELETE FROM {files} WHERE fid = %d', $fid); + } + // Remove it from the session in the case of new uploads, // that you want to disassociate before node submission. unset($_SESSION['upload_files'][$fid]); |