function revision_scheduler_operation_save in Revision scheduler 7
Save a scheduled revision operation to the database.
Parameters
object $operation: A scheduled revision operation record.
5 calls to revision_scheduler_operation_save()
- RevisionSchedulerFunctionalTestCase::testDeletedRevisions in tests/
RevisionSchedulerFunctionalTestCase.test - revision_scheduler_edit_form_submit in ./
revision_scheduler.pages.inc - revision_scheduler_entity_insert in ./
revision_scheduler.module - Implements hook_entity_insert().
- revision_scheduler_entity_update in ./
revision_scheduler.module - Implements hook_entity_update().
- revision_scheduler_operation_process in ./
revision_scheduler.module - Process a single scheduled revision operation.
File
- ./
revision_scheduler.module, line 498
Code
function revision_scheduler_operation_save($operation) {
$operation->is_new = empty($operation->id);
if (!isset($operation->uid)) {
$operation->uid = $GLOBALS['user']->uid;
}
// Ensure the scheduled time is converted to a timestamp.
if (!empty($operation->time_scheduled) && !is_numeric($operation->time_scheduled)) {
$operation->time_scheduled = strtotime($operation->time_scheduled);
}
// Should we reset queued?
//$operation->queued = 0;
if ($operation->is_new) {
drupal_write_record('revision_scheduler', $operation);
}
else {
drupal_write_record('revision_scheduler', $operation, array(
'id',
));
}
unset($operation->is_new);
}