protected function execute(InputInterface $input, OutputInterface $output)
    {
        $iterationCount = (int)$input->getOption('iteration-count');

        $locationsCount = $this->repository->sudo(
            function (Repository $repository) {
                return $repository->getLocationService()->getAllLocationsCount();
            }
        );

        $helper = $this->getHelper('question');
        $question = new ConfirmationQuestion(
            sprintf(
                "<info>Found %d Locations.</info>\n%s\n<info>Do you want to proceed? [y/N] </info>",
                $locationsCount,
                self::BEFORE_RUNNING_HINTS
            ),
            false
        );
        if (!$helper->ask($input, $output, $question)) {
            return;
        }

        $output->writeln('Regenerating System URL aliases...');

        $progressBar = $this->getProgressBar($locationsCount, $output);
        $progressBar->start();

        for ($offset = 0; $offset <= $locationsCount; $offset += $iterationCount) {
            gc_disable();
            $locations = $this->repository->sudo(
                function (Repository $repository) use ($offset, $iterationCount) {
                    return $repository->getLocationService()->loadAllLocations($offset, $iterationCount);
                }
            );
            $this->processLocations($locations, $progressBar);
            gc_enable();
        }
        $progressBar->finish();
        $output->writeln('');
        $output->writeln('<info>Done.</info>');

        $output->writeln('<info>Cleaning up corrupted URL aliases...</info>');
        $corruptedAliasesCount = $this->repository->sudo(
            function (Repository $repository) {
                return $repository->getURLAliasService()->deleteCorruptedUrlAliases();
            }
        );
        $output->writeln("<info>Done. Deleted {$corruptedAliasesCount} entries.</info>");
        $output->writeln('<comment>Make sure to clear HTTP cache afterwards.</comment>');
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $iterationCount = (int)$input->getOption('iteration-count');

        $locationsCount = $this->repository->sudo(
            function (Repository $repository) {
                return $repository->getLocationService()->getAllLocationsCount();
            }
        );

        $helper = $this->getHelper('question');
        $question = new ConfirmationQuestion(
            sprintf(
                "<info>Found %d Locations.</info>\n%s\n<info>Do you want to proceed? [y/N] </info>",
                $locationsCount,
                self::BEFORE_RUNNING_HINTS
            ),
            false
        );
        if (!$helper->ask($input, $output, $question)) {
            return;
        }

        $output->writeln('Regenerating System URL aliases...');

        $progressBar = $this->getProgressBar($locationsCount, $output);
        $progressBar->start();

        for ($offset = 0; $offset <= $locationsCount; $offset += $iterationCount) {
            gc_disable();
            $locations = $this->repository->sudo(
                function (Repository $repository) use ($offset, $iterationCount) {
                    return $repository->getLocationService()->loadAllLocations($offset, $iterationCount);
                }
            );
            $this->processLocations($locations, $progressBar);
            gc_enable();
        }
        $progressBar->finish();
        $output->writeln('');
        $output->writeln('<info>Done.</info>');

        $output->writeln('<info>Cleaning up corrupted URL aliases...</info>');
        $corruptedAliasesCount = $this->repository->sudo(
            function (Repository $repository) {
                return $repository->getURLAliasService()->deleteCorruptedUrlAliases();
            }
        );
        $output->writeln("<info>Done. Deleted {$corruptedAliasesCount} entries.</info>");
        $output->writeln('<comment>Make sure to clear HTTP cache afterwards.</comment>');
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { $ iterationCount = ( int ) $ input -> getOption ( 'iteration-count' ) ; $ locationsCount = $ this -> repository -> sudo ( function ( Repository $ repository ) { return $ repository -> getLocationService ( ) -> getAllLocationsCount ( ) ; } ) ; $ helper = $ this -> getHelper ( 'question' ) ; $ question = new ConfirmationQuestion ( sprintf ( "<info>Found %d Locations.</info>\n%s\n<info>Do you want to proceed? [y/N] </info>" , $ locationsCount , self :: BEFORE_RUNNING_HINTS ) , false ) ; if ( ! $ helper -> ask ( $ input , $ output , $ question ) ) { return ; } $ output -> writeln ( 'Regenerating System URL aliases...' ) ; $ progressBar = $ this -> getProgressBar ( $ locationsCount , $ output ) ; $ progressBar -> start ( ) ; for ( $ offset = 0 ; $ offset <= $ locationsCount ; $ offset += $ iterationCount ) { gc_disable ( ) ; $ locations = $ this -> repository -> sudo ( function ( Repository $ repository ) use ( $ offset , $ iterationCount ) { return $ repository -> getLocationService ( ) -> loadAllLocations ( $ offset , $ iterationCount ) ; } ) ; $ this -> processLocations ( $ locations , $ progressBar ) ; gc_enable ( ) ; } $ progressBar -> finish ( ) ; $ output -> writeln ( '' ) ; $ output -> writeln ( '<info>Done.</info>' ) ; $ output -> writeln ( '<info>Cleaning up corrupted URL aliases...</info>' ) ; $ corruptedAliasesCount = $ this -> repository -> sudo ( function ( Repository $ repository ) { return $ repository -> getURLAliasService ( ) -> deleteCorruptedUrlAliases ( ) ; } ) ; $ output -> writeln ( "<info>Done. Deleted {$corruptedAliasesCount} entries.</info>" ) ; $ output -> writeln ( '<comment>Make sure to clear HTTP cache afterwards.</comment>' ) ; }
Regenerate URL aliases.

{@inheritdoc}
Regenerate URL aliases .