protected function generateLegacyAutoloads()
    {
        $this->output->writeln('');
        $this->output->write('Generating legacy autoloads... ');

        $currentWorkingDirectory = getcwd();

        try {
            chdir($this->getContainer()->getParameter('ezpublish_legacy.root_dir'));

            $processBuilder = new ProcessBuilder(
                array(
                    'php',
                    'bin/php/ezpgenerateautoloads.php',
                    '--quiet',
                )
            );

            $process = $processBuilder->getProcess();

            $process->setTimeout(3600);
            $process->run(
                function ($type, $buffer) {
                    echo $buffer;
                }
            );

            chdir($currentWorkingDirectory);

            if (!$process->isSuccessful()) {
                return array(
                    '- Run the following command from your ezpublish_legacy root to generate legacy autoloads:',
                    '',
                    '    <comment>php bin/php/ezpgenerateautoloads.php</comment>',
                    '',
                );
            }
        } catch (Exception $e) {
            chdir($currentWorkingDirectory);

            return array(
                'There was an error generating legacy autoloads: ' . $e->getMessage(),
                '',
            );
        }
    }