file_set_status() was added in Drupal 6 as a way of changing a temporary file to a permanent file back before file_save() was added. In it's current implementation the function has an annoying overlap with the functionality provided by file_save().
All file_set_status() does is changes the status field of a row in the {files} table and call hook_file_status. But there's nothing to stop you from assigning the file's status and then calling file_save() which would circumvent the call to hook_file_status.
It also diverges from the patterns established else where in core. We don't have a node_set_status() function, you just do a $node->status = 1; node_save($node); and I think the same should be true for files.
Comment | File | Size | Author |
---|---|---|---|
#10 | file_docs_cleanup.patch | 908 bytes | drewish |
#8 | file_docs_cleanup.patch | 916 bytes | drewish |
#1 | file_331013.patch | 9.63 KB | drewish |
file_no_more_set_status.patch | 9.95 KB | drewish | |
Comments
Comment #1
drewish CreditAttribution: drewish commentedre-rolled
Comment #2
Dries CreditAttribution: Dries commentedMakes sense, and the patch works as advertised. I committed this to CVS HEAD. Please mark as 'fixed' once the module upgrade guide has been updated. Thanks drewish.
Comment #3
drewish CreditAttribution: drewish commentedhttp://drupal.org/node/224333#file_set_status
Comment #5
CitizenKane CreditAttribution: CitizenKane commentedComment #6
drewish CreditAttribution: drewish commentedany reason you bumped this back to fixed?
Comment #7
CitizenKane CreditAttribution: CitizenKane commentedAccidental click on my part. Sorry about that.
Comment #8
drewish CreditAttribution: drewish commentedRealized we forgot to remove the hook from the docs.
Comment #10
drewish CreditAttribution: drewish commentedwhoops, had the prefix in that patch.
Comment #11
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks! :)