You are here

function block_revisions_create_revision in Block Revisions 6

Same name and namespace in other branches
  1. 7 block_revisions.module \block_revisions_create_revision()
2 calls to block_revisions_create_revision()
block_revisions_revert_confirm_submit in ./block_revisions.admin.inc
_block_revisions_form_submit in ./block_revisions.module

File

./block_revisions.module, line 174

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_result(db_query('SELECT max(vid) FROM {boxes_revisions} WHERE bid = %d', $bid));
  $revision->vid = isset($revision_id) ? $revision_id + 1 : 1;
  $revision->timestamp = time();
  $revision->uid = $user->uid;
  return drupal_write_record('boxes_revisions', $revision);
}