function comment_upload_nodeapi in Comment Upload 5
Same name and namespace in other branches
- 6 comment_upload.module \comment_upload_nodeapi()
Delete files and records associated with comments on the deleted node.
Implementation of hook_nodeapi.
File
- ./
comment_upload.module, line 284
Code
function comment_upload_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
if ($op == 'delete') {
$result = db_query("SELECT * FROM {comment_upload_files} WHERE nid = %d", $node->nid);
while ($file = db_fetch_object($result)) {
file_delete($file->filepath);
}
// Delete all comments
db_query("DELETE FROM {comment_upload_files} WHERE nid = %d", $node->nid);
}
}