diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-07-01 17:41:16 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-07-01 17:41:16 +0000 |
commit | e59852d336467e7269853724a28d80bc070bcbf6 (patch) | |
tree | 5be53c3b52d923476e8be517f15251f1487efa9c /modules/upload | |
parent | c11cb4ec24479e801076c094f043f2084b344d0c (diff) | |
download | brdo-e59852d336467e7269853724a28d80bc070bcbf6.tar.gz brdo-e59852d336467e7269853724a28d80bc070bcbf6.tar.bz2 |
- Rollback of patch #147723: delete API. Talked to Steven and Gabor and we
unanimously agreed to rollback the deletion API. We all support the
features this patch added, yet not its actual design and implementation.
After some talk, we decided that it would be better for Drupal -- in the
long term -- not to go with a solution that isn't 100%. We also recognize
that in the short term, this patch would have been useful addition. So
let's figure out how we can implement this properly in D7.
Diffstat (limited to 'modules/upload')
-rw-r--r-- | modules/upload/upload.module | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/modules/upload/upload.module b/modules/upload/upload.module index 43ae3f2f3..f8ddc5f86 100644 --- a/modules/upload/upload.module +++ b/modules/upload/upload.module @@ -575,44 +575,31 @@ function upload_delete($node) { } foreach ($files as $fid => $file) { - // Delete all file revision information associated with the node - drupal_delete_add_query('DELETE FROM {files} WHERE fid = %d', $fid); + // Delete all files associated with the node + db_query('DELETE FROM {files} WHERE fid = %d', $fid); + file_delete($file->filepath); } - // Delete all files associated with the node - drupal_delete_add_query('DELETE FROM {upload} WHERE nid = %d', $node->nid); - - // Register a callback to delete the files. - drupal_delete_add_callback(array('upload_delete_post' => array($files))); + // Delete all file revision information associated with the node + db_query('DELETE FROM {upload} WHERE nid = %d', $node->nid); } function upload_delete_revision($node) { if (is_array($node->files)) { - $files = array(); foreach ($node->files as $file) { // Check if the file will be used after this revision is deleted $count = db_result(db_query('SELECT COUNT(fid) FROM {upload} WHERE fid = %d', $file->fid)); // if the file won't be used, delete it if ($count < 2) { - drupal_delete_add_query('DELETE FROM {files} WHERE fid = %d', $file->fid); - $files[$file->fid] = $file; + db_query('DELETE FROM {files} WHERE fid = %d', $file->fid); + file_delete($file->filepath); } } } - // Delete the revision. - drupal_delete_add_query('DELETE FROM {upload} WHERE vid = %d', $node->vid); - - // Register a callback to delete the files. - drupal_delete_add_callback(array('upload_delete_post' => array($files))); -} - -function upload_delete_post($files) { - foreach ($files as $file) { - // Delete all files associated with the node or revision. - file_delete($file->filepath); - } + // delete the revision + db_query('DELETE FROM {upload} WHERE vid = %d', $node->vid); } function _upload_form($node) { |