Author: Fabien Potencier (fabien@symfony.com)
Author: Gábor Egyed (gabor.egyed@gmail.com)
Inheritance: extends Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand
コード例 #1
0
ファイル: Refresher.php プロジェクト: ngydat/CoreBundle
 public function installAssets()
 {
     $webDir = "{$this->container->get('kernel')->getRootDir()}/../web";
     $args = array('target' => $webDir);
     $assetInstallCmd = new AssetsInstallCommand();
     $assetInstallCmd->setContainer($this->container);
     $assetInstallCmd->run(new ArrayInput($args), $this->output ?: new NullOutput());
 }
コード例 #2
0
 private function installAssets($output)
 {
     $command = new AssetsInstallCommand();
     $command->setContainer($this->getContainer());
     $subInput = new StringInput('--symlink --relative');
     $command->run($subInput, $output);
     $output->writeln('<info>installAssets成功</info>');
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function setContainer(ContainerInterface $container = null)
 {
     parent::setContainer($container);
     if (null === $container) {
         $this->containerProxy = null;
     } else {
         $this->containerProxy = new ContainerProxy($container);
     }
 }
コード例 #4
0
 /**
  * @throws \Exception
  */
 private static function clearCache()
 {
     $sProdCache = self::$_container->get('kernel')->getRootDir() . "/cache/prod";
     $sDevCache = self::$_container->get('kernel')->getRootDir() . "/cache/dev";
     if (is_dir($sProdCache)) {
         self::deleteTree($sProdCache);
     }
     if (is_dir($sDevCache)) {
         self::deleteTree($sDevCache);
     }
     $command = new AssetsInstallCommand();
     $command->setContainer(self::$_container);
     $input = new ArgvInput(array('assets:install', self::$_container->get('kernel')->getRootDir() . "/../web"));
     $output = new NullOutput();
     $command->run($input, $output);
     $process = new Process('cd ' . self::$_container->get('kernel')->getRootDir() . ' && php console assetic:dump');
     $process->run();
     // executes after the command finishes
     if (!$process->isSuccessful()) {
         throw new \RuntimeException($process->getErrorOutput());
     }
 }
コード例 #5
0
 /**
  * Runs the post install commands.
  */
 private function runPostInstallCommands()
 {
     $rootDir = $this->container->getParameter('kernel.root_dir');
     if (is_dir($rootDir . '/../files') && is_link($rootDir . '/../web/assets')) {
         return;
     }
     // Install the bundle assets
     $command = new AssetsInstallCommand();
     $command->setContainer($this->container);
     $command->run(new ArgvInput(['assets:install', '--relative', $rootDir . '/../web']), new NullOutput());
     // Add the Contao directories
     $command = new InstallCommand();
     $command->setContainer($this->container);
     $command->run(new ArgvInput([]), new NullOutput());
     // Generate the symlinks
     $command = new SymlinksCommand();
     $command->setContainer($this->container);
     $command->run(new ArgvInput([]), new NullOutput());
 }