From 6481b28fe526abbeb8a176cbc2791872192b0fab Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 16 Jun 2011 09:23:43 +0100 Subject: [PATCH] MDL-27878 make progress bars fail explicity if you forget to call create(). --- lib/weblib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index fb4b7ea18ad..290cf533d8b 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -3060,8 +3060,9 @@ EOT; * @return void Echo's output */ private function _update($percent, $msg) { - if (empty($this->time_start)){ - $this->time_start = microtime(true); + if (empty($this->time_start)) { + throw new coding_exception('You must call create() (or use the $autostart ' . + 'argument to the constructor) before you try updating the progress bar.'); } if (CLI_SCRIPT) {