aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/video_upload/video_upload.module19
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) {