function rotor_update in Rotor Banner 5
Same name and namespace in other branches
- 5.7 rotor.module \rotor_update()
- 6 rotor.module \rotor_update()
Implementation of hook_update().
File
- ./
rotor.module, line 391 - A rotor banner consists in a set of images that will be changing. This module is made using jquery.
Code
function rotor_update($node) {
$rotor_item = db_fetch_object(db_query('SELECT fid FROM {rotor_item} where nid = %d', $node->nid));
$file = db_fetch_object(db_query('SELECT * FROM {files} where fid = %d', $rotor_item->fid));
db_query('DELETE FROM {files} WHERE fid = %d', $rotor_item->fid);
file_delete($file->filepath);
db_query("UPDATE {rotor_item} SET fid = %d, alt_text = '%s', url = '%s', link_target = '%s' WHERE nid = %d", $node->rotor_image, $node->alt_text, $node->url, $node->link_target, $node->nid);
}