phpbb\console\command\reparser\reparse::reparse PHP Méthode

reparse() protected méthode

Reparse all text handled by given reparser within given range
protected reparse ( string $name )
$name string Reparser service name
    protected function reparse($name)
    {
        $reparser = $this->reparsers[$name];
        $this->resume_data = $this->reparser_manager->get_resume_data($name);
        if ($this->input->getOption('dry-run')) {
            $reparser->disable_save();
        } else {
            $reparser->enable_save();
        }
        // Start at range-max if specified or at the highest ID otherwise
        $max = $this->get_option('range-max');
        $min = $this->get_option('range-min');
        $size = $this->get_option('range-size');
        // range-max has no default value, it must be computed for each reparser
        if ($max === null) {
            $max = $reparser->get_max_id();
        }
        if ($max < $min) {
            return;
        }
        $this->io->section($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', $reparser->get_name(), $min, $max));
        $progress = $this->create_progress_bar($max, $this->io, $this->output, true);
        $progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING_START', $reparser->get_name()));
        $progress->start();
        // Start from $max and decrement $current by $size until we reach $min
        $current = $max;
        while ($current >= $min) {
            $start = max($min, $current + 1 - $size);
            $end = max($min, $current);
            $progress->setMessage($this->user->lang('CLI_REPARSER_REPARSE_REPARSING', $reparser->get_name(), $start, $end));
            $reparser->reparse_range($start, $end);
            $current = $start - 1;
            $progress->setProgress($max + 1 - $start);
            $this->reparser_manager->update_resume_data($name, $min, $current, $size, !$this->input->getOption('dry-run'));
        }
        $progress->finish();
        $this->io->newLine(2);
    }