You are here

function sheetnode_update in Sheetnode 5

Same name and namespace in other branches
  1. 6 sheetnode.module \sheetnode_update()
  2. 7.2 sheetnode.module \sheetnode_update()
  3. 7 sheetnode.module \sheetnode_update()

Implementation of hook_update().

File

./sheetnode.module, line 168

Code

function sheetnode_update($node) {
  if (!empty($node->sheetsave)) {
    _sheetnode_save($node->nid, $node->vid, $node->sheetsave);
  }
  else {
    if (!empty($node->revision)) {

      // reverting a revision
      db_query('INSERT INTO {sheetnode} (nid,vid,value) SELECT old.nid,%d,old.value FROM sheetnode AS old WHERE old.vid=%d', array(
        $node->vid,
        $node->old_vid,
      ));
    }
  }
  if (!empty($node->template) && user_access('create sheet template')) {
    _sheetnode_template_save($node->vid, $node->template, $node->sheetsave);
  }
}