Ejemplo n.º 1
0
    foreach ($commands as $command) {
        $output->writeln(sprintf('<info>Executing : </info> %s', $command));
        $p = new \Symfony\Component\Process\Process($command);
        $p->setTimeout(null);
        $p->run(function ($type, $data) use($output) {
            $output->write($data, false, OutputInterface::OUTPUT_RAW);
        });
        if (!$p->isSuccessful()) {
            return false;
        }
        $output->writeln("");
    }
    return true;
}
// find out the default php runtime
$bin = 'php';
if (defined('PHP_BINARY')) {
    $bin = PHP_BINARY;
}
$output->writeln("<info>Resetting project</info>");
$fs->remove(sprintf('%s/web/uploads/media', $rootDir));
$fs->mkdir(sprintf('%s/web/uploads/media', $rootDir));
$output->writeln("<info>Setting symlink app.php => index.php</info>");
$fs->symlink(sprintf('%s/web/app.php', $rootDir), sprintf('%s/web/index.php', $rootDir));
$success = execute_commands(array('rm -rf ./app/cache/*', $bin . ' ./app/console cache:warmup --env=prod --no-debug', $bin . ' ./app/console cache:create-cache-class --env=prod --no-debug', $bin . ' ./app/console doctrine:database:drop --force', $bin . ' ./app/console doctrine:database:create', $bin . ' ./app/console doctrine:schema:update --force', $bin . '  -d memory_limit=1024M -d max_execution_time=600 ./app/console doctrine:fixtures:load --verbose --env=dev --no-debug', $bin . ' ./app/console assets:install --symlink web'), $output);
if (!$success) {
    $output->writeln('<info>An error occurs when running a command!</info>');
    exit(1);
}
$output->writeln('<info>Done!</info>');
exit(0);