diff options
author | Fabio Varesano <fax8@13637.no-reply.drupal.org> | 2006-06-22 20:18:33 +0000 |
---|---|---|
committer | Fabio Varesano <fax8@13637.no-reply.drupal.org> | 2006-06-22 20:18:33 +0000 |
commit | 2d06475b0af4800e772ac5011b7bd65a11bf2026 (patch) | |
tree | 89d061f723acba78d49b96a260643ddcd97ce4ad /plugins | |
parent | 4c39dbd94cefcf684a3c70653b672e8de053a45b (diff) | |
download | video-2d06475b0af4800e772ac5011b7bd65a11bf2026.tar.gz video-2d06475b0af4800e772ac5011b7bd65a11bf2026.tar.bz2 |
Added nodeapi called fuction to delete the uploaded file when video node is
deleted.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/video_upload/video_upload.module | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module index b06389b..e85e334 100644 --- a/plugins/video_upload/video_upload.module +++ b/plugins/video_upload/video_upload.module @@ -94,7 +94,7 @@ function video_upload_nodeapi(&$node, $op, $teaser) { break; case 'delete': - ; + _video_upload_delete($node); break; case 'delete revision': @@ -209,14 +209,27 @@ function _video_upload_store(&$node) { unset($_SESSION['video_upload_file']); } else { - print 'error'; + drupal_set_message(t('An error occurred during file saving. Your video file has not been stored.'), 'error'); } - } } /** + * Delete files associated to this video node + */ +function _video_upload_delete(&$node) { + + // delete file + file_delete($node->video_upload_file->path); + + // delete file information from database + db_query('DELETE FROM {file_revisions} WHERE fid = %d', $node->video_upload_file->fid); + db_query('DELETE FROM {files} WHERE fid = %d', $node->video_upload_file->fid); +} + + +/** * Create video upload specific form fields */ function _video_upload_form($node) { |