MDL-49324 Output: The progress bar output is buffered.
authorDamyon Wiese <damyon@moodle.com>
Fri, 27 Feb 2015 08:31:56 +0000 (16:31 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 23 Feb 2016 00:35:10 +0000 (08:35 +0800)
Each call to update the progress bar needs to fill the output buffer so that it
gets sent immediately.

lib/classes/progress/display.php

index 4e3b46f..b7974bc 100644 (file)
@@ -126,6 +126,11 @@ class display extends base {
                     $this->direction = -$this->direction;
                     $this->currentstate += 2 * $this->direction;
                 }
+                $buffersize = ini_get('output_buffering');
+                if ($buffersize) {
+                    // Force the buffer full.
+                    echo str_pad('', $buffersize);
+                }
             }
 
             // Get progress.