public function TripalJob::setProgress
3.x TripalJob.inc | public TripalJob::setProgress($percent_done) |
Sets the current percent complete of a job.
Parameters
$percent_done: A value between 0 and 100 indicating the percentage complete of the job.
1 call to TripalJob::setProgress()
- TripalJob::setItemsHandled in tripal/
includes/ TripalJob.inc - Sets the number of items that have been processed.
File
- tripal/
includes/ TripalJob.inc, line 422
Class
Code
public function setProgress($percent_done) {
if (!$this->job) {
throw new Exception('Cannot set progress as no job is associated with this object.');
}
$this->job->progress = $percent_done;
$progress = sprintf("%d", $percent_done);
db_update('tripal_jobs')
->fields(array(
'progress' => $progress,
))
->condition('job_id', $this->job->job_id)
->execute();
}