/** * Clears the APC/Wincache/Opcache cache. * * @param $event CommandEvent A instance */ public static function clearCache(CommandEvent $event) { $options = parent::getOptions($event); //$consoleDir = parent::getConsoleDir($event, 'clear the PHP Accelerator cache'); $appDir = $options['symfony-app-dir']; if (null === $appDir) { return; } $opcode = ''; if (array_key_exists('accelerator-cache-opcode', $options)) { $opcode .= ' --opcode'; } $user = ''; if (array_key_exists('accelerator-cache-user', $options)) { $user .= ' --user'; } $cli = ''; if (array_key_exists('accelerator-cache-cli', $options)) { $cli .= ' --cli'; } $auth = ''; if (array_key_exists('accelerator-cache-auth', $options)) { $auth .= ' --auth ' . escapeshellarg($options['accelerator-cache-auth']); } static::executeCommand($event, $appDir, 'cache:accelerator:clear' . $opcode . $user . $cli . $auth, $options['process-timeout']); }
/** * @param $event CommandEvent A instance */ public static function installTranslations(CommandEvent $event) { $options = parent::getOptions($event); $appDir = $options['symfony-app-dir']; parent::executeCommand($event, $appDir, 'sulu:translate:import en'); parent::executeCommand($event, $appDir, 'sulu:translate:import de'); parent::executeCommand($event, $appDir, 'sulu:translate:export en json'); parent::executeCommand($event, $appDir, 'sulu:translate:export de json'); }
/** * Clears the Symfony cache. * * Overloaded to clear project containers first before booting up Symfony container as part of clearCache() => * cache:clear call. Since this will crash with RuntimeException if bundles have been removed or added when for * instance moving between git branches and running `composer install/update` afterwards. * * @param Event $event */ public static function clearCache(Event $event) { $options = static::getOptions($event); $cacheDir = $options['symfony-app-dir'] . '/cache'; // Take Symfony 3.0 directory structure into account if configured. if (isset($options['symfony-var-dir']) && is_dir($options['symfony-var-dir'])) { $cacheDir = $options['symfony-var-dir'] . '/cache'; } array_map('unlink', glob($cacheDir . '/*/*ProjectContainer.php')); parent::clearCache($event); }
/** * @param $event CommandEvent A instance */ public static function initBundle(CommandEvent $event) { $options = parent::getOptions($event); $appDir = $options['symfony-app-dir']; parent::executeCommand($event, $appDir, 'sulu:media:init'); }
/** * @param $event Event A instance */ public static function initBundle(Event $event) { $options = parent::getOptions($event); $consoleDir = isset($options['symfony-bin-dir']) ? $options['symfony-bin-dir'] : $options['symfony-app-dir']; parent::executeCommand($event, $consoleDir, 'sulu:media:init'); }
public static function setupNewDirectoryStructure(CommandEvent $event) { ScriptHandler::defineDirectoryStructure($event); }
exit(sprintf($message, $path)); } return $path; } $argv = $_SERVER['argv']; $autoloadDir = $bootstrapDir = null; $useNewDirectoryStructure = false; // allow the base path to be passed as the first argument, or default if (!empty($argv[1])) { $bootstrapDir = getRealpath($argv[1]); } if (!empty($argv[2])) { $autoloadDir = getRealpath($argv[2]); } if (!empty($argv[3])) { $useNewDirectoryStructure = true; } $rootDir = __DIR__ . '/../../../../../../../..'; if (null === $autoloadDir) { $autoloadDir = getRealpath($rootDir . '/app', 'Looks like you don\'t have a standard layout.'); } if (null === $bootstrapDir) { $bootstrapDir = $autoloadDir; if ($useNewDirectoryStructure) { $bootstrapDir = getRealpath($rootDir . '/var'); } } require_once $autoloadDir . '/autoload.php'; // here we pass realpaths as resolution between absolute and relative path can be wrong ScriptHandler::doBuildBootstrap($bootstrapDir);
exit(sprintf($message, $path)); } return $path; } $argv = $_SERVER['argv']; $autoloadDir = $bootstrapDir = null; $useNewDirectoryStructure = false; // allow the base path to be passed as the first argument, or default if (!empty($argv[1])) { $bootstrapDir = getRealpath($argv[1]); } if (!empty($argv[2])) { $autoloadDir = getRealpath($argv[2]); } if (!empty($argv[3])) { $useNewDirectoryStructure = true; } $rootDir = __DIR__ . '/../../../../../../../..'; if (null === $autoloadDir) { $autoloadDir = getRealpath($rootDir . '/app', 'Looks like you don\'t have a standard layout.'); } if (null === $bootstrapDir) { $bootstrapDir = $autoloadDir; if ($useNewDirectoryStructure) { $bootstrapDir = getRealpath($rootDir . '/var'); } } require_once $autoloadDir . '/autoload.php'; // here we pass realpaths as resolution between absolute and relative path can be wrong ScriptHandler::doBuildBootstrap($bootstrapDir, $autoloadDir, $useNewDirectoryStructure);
#!/usr/bin/env php <?php /* * This file is part of the Symfony Standard Edition. * * (c) Fabien Potencier <*****@*****.**> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ if (PHP_SAPI !== 'cli') { echo __FILE__ . ' should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL; exit(1); } $argv = $_SERVER['argv']; // allow the base path to be passed as the first argument, or default if (isset($argv[1])) { $appDir = $argv[1]; } else { if (!($appDir = realpath(__DIR__ . '/../../../../../../../../app'))) { exit('Looks like you don\'t have a standard layout.'); } } require_once $appDir . '/autoload.php'; \Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::doBuildBootstrap($appDir);
/** * Runs the post install commands. * * @return Response|null */ public function runPostInstallCommands() { $rootDir = $this->getContainerParameter('kernel.root_dir'); $response = $this->runCommand(new AssetsInstallCommand(), new ArgvInput(['assets:install', '--relative', $rootDir . '/../web'])); if (null !== $response) { return $response; } // Add the Contao directories if (null !== ($response = $this->runCommand(new InstallCommand()))) { return $response; } // Generate the symlinks if (null !== ($response = $this->runCommand(new SymlinksCommand()))) { return $response; } // Build the bootstrap.php.cache file ScriptHandler::doBuildBootstrap($this->getContainerParameter('kernel.cache_dir') . '/../..'); return null; }
/** * @param $event Event A instance */ public static function installTranslations(Event $event) { $options = parent::getOptions($event); $consoleDir = isset($options['symfony-bin-dir']) ? $options['symfony-bin-dir'] : $options['symfony-app-dir']; parent::executeCommand($event, $consoleDir, 'sulu:translate:export'); }