function block_revisions_create_revision in Block Revisions 6
Same name and namespace in other branches
- 7 block_revisions.module \block_revisions_create_revision()
2 calls to block_revisions_create_revision()
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);
}