public function update_progress() {
        // If finished...
        if (!$this->is_in_progress_section()) {
            if ($this->bar) {
                $this->end_html();
            }
        } else {
            if (!$this->bar) {
                $this->start_html();
            }
            // In case of indeterminate or small progress, update the wibbler
            // (up to once per second).
            if (time() != $this->lastwibble) {
                $this->lastwibble = time();
                echo \html_writer::div('', 'wibble state' . $this->currentstate);

                // Go on to next colour.
                $this->currentstate += $this->direction;
                if ($this->currentstate < 0 || $this->currentstate >= self::WIBBLE_STATES) {
                    $this->direction = -$this->direction;
                    $this->currentstate += 2 * $this->direction;
                }
                $buffersize = ini_get('output_buffering');
                if (!is_numeric($buffersize)) {
                    // The output_buffering setting can be a number, but can also be "On" or "Off".
                    // If "Off", there's no buffer, if "On", there's no limit to the size. In either case,
                    // there's no point in trying to fill the buffer.
                    $buffersize = 0;
                }
                if ($buffersize) {
                    // Force the buffer full.
                    echo str_pad('', $buffersize);
                }
            }

            // Get progress.
            list ($min, $max) = $this->get_progress_proportion_range();

            // Update progress bar.
            $message = '';
            if ($this->displaynames) {
                $message = $this->get_current_description();
            }
            $this->bar->update_full($min * 100, $message);

            // Flush output.
            flush();
        }
    }