function _itweak_upload_delete in iTweak Upload 6.2
Take care of imagecache when node is deleted.
1 call to _itweak_upload_delete()
- itweak_upload_nodeapi in ./
itweak_upload.module - Implementation of hook_nodeapi().
File
- ./
itweak_upload.module, line 1361 - iTweakUpload - Tweak attachments display and file upload forms.
Code
function _itweak_upload_delete(&$node) {
if (function_exists('imagecache_file_delete')) {
if (isset($node->files)) {
foreach ($node->files as $fid => $file) {
// Instead of figuring out if file has other references, been replaced
// or why else it should not be flushed form imagecache,
// we purge the cache regardless.
// Imagecache will rebuild it when needed if there are other references.
imagecache_file_delete((object) $file);
}
}
// Deal with comment_upload files here
if (module_exists('comment_upload')) {
$result = db_query("SELECT cu.fid, cu.nid, f.filepath FROM {comment_upload} cu INNER JOIN {files} f ON cu.fid = f.fid WHERE cu.nid = %d", $node->nid);
while ($file = db_fetch_array($result)) {
// imagecache_file_delete just needs a filepath.
imagecache_file_delete((object) $file);
}
}
}
}