From 65a5785ce59e744ed7c827db0781149078873676 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Thu, 13 Apr 2017 14:52:07 +0900 Subject: [PATCH] Changed progress bar buffer clear - send initial big buffer clear - then do just flush/ob_flush --- www/libs/Class.Progressbar.inc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/www/libs/Class.Progressbar.inc b/www/libs/Class.Progressbar.inc index ecc4436e..67029c99 100644 --- a/www/libs/Class.Progressbar.inc +++ b/www/libs/Class.Progressbar.inc @@ -20,7 +20,8 @@ class ProgressBar public $step = 0; // current step public $position = array(); // current bar position - public $clear_buffer_size = 1024*256; // we need to send this before the lfush to get browser output + public $clear_buffer_size = 1; // we need to send this before the lfush to get browser output + public $clear_buffer_size_init = 1024*1024; // if I don't send that junk, it won't send anything // public vars @@ -76,13 +77,16 @@ class ProgressBar $this->width = $width; if ($height > 0) $this->height = $height; + $this->_flushCache($this->clear_buffer_size_init); } // private functions - private function _flushCache() + private function _flushCache($clear_buffer_size = 0) { - echo str_repeat(' ', $this->clear_buffer_size); + if (!$clear_buffer_size) + $clear_buffer_size = $this->clear_buffer_size; + echo str_repeat(' ', $clear_buffer_size); ob_flush(); flush(); }