i18nsync_node_delete_prepare
- Versions
- 6
i18nsync_node_delete_prepare($nid)
Prepare node for deletion, work out synchronization issues
Code
contrib/i18n/i18nsync/i18nsync.module, line 126
<?php
function i18nsync_node_delete_prepare($nid) {
$node = node_load($nid);
// Delete file associations when files are shared with existing translations
// so they are not removed by upload module
if (!empty($node->tnid) && module_exists('upload')) {
$result = db_query('SELECT u.* FROM {upload} u WHERE u.nid = %d AND u.fid IN (SELECT t.fid FROM {upload} t WHERE t.fid = u.fid AND t.nid <> u.nid)', $nid);
while ($up = db_fetch_object($result)) {
db_query("DELETE FROM {upload} WHERE fid = %d AND vid = %d", $up->fid, $up->vid);
}
}
}
?>


