function progress_set_progress in Progress 8
Same name and namespace in other branches
- 6 progress.module \progress_set_progress()
- 7 progress.module \progress_set_progress()
Set progress
1 call to progress_set_progress()
- progress_set_intervalled_progress in ./
progress.module - Set intervalled progress
File
- ./
progress.module, line 35 - Progress framework for keeping track of progresses
Code
function progress_set_progress($name, $message, $progress) {
$current = microtime(TRUE);
$result = db_update('progress')
->fields(array(
'progress' => $progress,
'message' => $message,
'current_stamp' => $current,
))
->condition('name', $name)
->execute();
if (\Drupal::moduleHandler()
->moduleExists('nodejs')) {
$start_stamp = db_query("SELECT start_stamp FROM {progress} WHERE name = :name", array(
':name' => $name,
))
->fetchField();
$object = (object) array(
'name' => $name,
'progress' => $progress,
'message' => $message,
'current_stamp' => $current,
'start_stamp' => $start_stamp,
);
$message = (object) array(
'channel' => 'progress',
'data' => (object) array(
'action' => 'setProgress',
'progress' => $object,
'timestamp' => microtime(TRUE),
),
'callback' => 'nodejsProgress',
);
\Drupal::moduleHandler()
->alter('progress_message', $message);
nodejs_send_content_channel_message($message);
}
return $result;
}