Skip to content

Commit 5078159

Browse files
authored
Merge pull request #1273 from marxjohnson/patch-8
MDL-81714 Update stored progress API example
2 parents 854094f + 0799446 commit 5078159

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/apis/subsystems/output/index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class stored_progress_scheduled_task_example extends \core\task\scheduled_task {
483483
// This simulates a specific count of iterations the task will do, e.g. x number of courses to loop through and do something.
484484
$iterations = 100;
485485

486-
$this->start_stored_progress(); // This creates the stored progress record for the named task.
486+
$this->start_stored_progress(); // Updates the stored progress record with a start time.
487487

488488
for ($i = 1; $i <= $iterations; $i++) {
489489

@@ -498,6 +498,9 @@ class stored_progress_scheduled_task_example extends \core\task\scheduled_task {
498498
}
499499

500500
}
501+
502+
$task = new stored_progress_scheduled_task_example();
503+
$task->initialise_stored_progress(); // Creates a stored progress record, so the progress can be displayed in "pending" state.
501504
```
502505

503506
With the stored progress bars, you can update the progress either via iterations, by passing in the total amount expected and then the current iteration, using `->update()`(see: previous example), this will calculate the percentage complete for you. Or you can use `->update_full()` to manually set the percentage complete.

0 commit comments

Comments
 (0)