You are here

function block_revisions_create_revision in Block Revisions 7

Same name and namespace in other branches
  1. 6 block_revisions.module \block_revisions_create_revision()

@todo Please document this function.

See also

http://drupal.org/node/1354

2 calls to block_revisions_create_revision()
block_revisions_revert_confirm_submit in ./block_revisions.admin.inc
@todo Please document this function.
_block_revisions_form_submit in ./block_revisions.module

File

./block_revisions.module, line 165

Code

function block_revisions_create_revision($bid, $body, $format, $log = NULL) {
  global $user;
  $revision = new stdClass();
  $revision->bid = $bid;
  $revision->body = $body;
  $revision->format = $format;
  $revision->log = $log;

  // Fetch the current revision number for this block to determine
  // the next revision number.
  $revision_id = db_query('SELECT max(vid) FROM {boxes_revisions} WHERE bid = :bid', array(
    ':bid' => $bid,
  ))
    ->fetchField();
  $revision->vid = isset($revision_id) ? $revision_id + 1 : 1;
  $revision->timestamp = REQUEST_TIME;
  $revision->uid = $user->uid;
  return drupal_write_record('boxes_revisions', $revision);
}