Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     $this->data = array('app_name' => $this->name, 'app_version' => $this->version, 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, 'symfony_state' => 'unknown', 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'xdebug_enabled' => extension_loaded('xdebug'), 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'), 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), 'bundles' => array(), 'sapi_name' => PHP_SAPI);
     if (isset($this->kernel)) {
         foreach ($this->kernel->getBundles() as $name => $bundle) {
             $this->data['bundles'][$name] = $bundle->getPath();
         }
         $this->data['symfony_state'] = $this->determineSymfonyState();
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param KernelInterface $kernel A KernelInterface instance
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
 }
Exemplo n.º 3
0
 /**
  * Constructor.
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName());
     $this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
     $this->kernel->boot();
     $this->registerCommands();
 }
Exemplo n.º 4
0
 /**
  * Constructor.
  *
  * @param KernelInterface $kernel A KernelInterface instance
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
     $this->getDefinition()->addOption(new InputOption('--process-isolation', null, InputOption::VALUE_NONE, 'Launch commands from shell as a separate processes.'));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
 }
Exemplo n.º 5
0
 /**
  * Constructor.
  */
 public function __construct(KernelInterface $kernel)
 {
     $this->kernel = $kernel;
     parent::__construct('Symfony', Kernel::VERSION . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->definition->addOption(new InputOption('--shell', '-s', InputOption::VALUE_NONE, 'Launch the shell.'));
     $this->definition->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'));
     $this->definition->addOption(new InputOption('--debug', '-d', InputOption::VALUE_NONE, 'Whether to run in debug mode.'));
     $this->kernel->boot();
     $this->registerCommands();
 }
Exemplo n.º 6
0
    /**
     * {@inheritdoc}
     */
    public function collect(Request $request, Response $response, \Exception $exception = null)
    {
        $this->data = array(
            'app_name' => $this->name,
            'app_version' => $this->version,
            'token' => $response->headers->get('X-Debug-Token'),
            'symfony_version' => Kernel::VERSION,
            'symfony_state' => 'unknown',
            'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
            'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a',
            'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
            'php_version' => PHP_VERSION,
            'php_architecture' => PHP_INT_SIZE * 8,
            'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
            'php_timezone' => date_default_timezone_get(),
            'xdebug_enabled' => extension_loaded('xdebug'),
            'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'),
            'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
            'bundles' => array(),
            'sapi_name' => PHP_SAPI,
        );

        if (isset($this->kernel)) {
            foreach ($this->kernel->getBundles() as $name => $bundle) {
                $this->data['bundles'][$name] = $bundle->getPath();
            }

            $this->data['symfony_state'] = $this->determineSymfonyState();
            $this->data['symfony_minor_version'] = sprintf('%s.%s', Kernel::MAJOR_VERSION, Kernel::MINOR_VERSION);
            $eom = \DateTime::createFromFormat('m/Y', Kernel::END_OF_MAINTENANCE);
            $eol = \DateTime::createFromFormat('m/Y', Kernel::END_OF_LIFE);
            $this->data['symfony_eom'] = $eom->format('F Y');
            $this->data['symfony_eol'] = $eol->format('F Y');
        }

        if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
            $this->data['php_version'] = $matches[1];
            $this->data['php_version_extra'] = $matches[2];
        }
    }
Exemplo n.º 7
0
 /**
  * @param KernelInterface           $kernel
  * @param EmbeddedComposerInterface $embeddedComposer
  */
 public function __construct(KernelInterface $kernel, EmbeddedComposerInterface $embeddedComposer)
 {
     $this->kernel = $kernel;
     $this->embeddedComposer = $embeddedComposer;
     $version = $embeddedComposer->findPackage('nanbando/core')->getPrettyVersion();
     if ($version !== self::GIT_VERSION && self::GIT_VERSION !== '@' . 'git_version' . '@') {
         $version .= ' (' . self::GIT_VERSION . ')';
     }
     parent::__construct('Nanbando', sprintf('%s - %s', $version, $kernel->getName()));
     foreach ($kernel->getBundles() as $bundle) {
         $bundle->registerCommands($this);
     }
 }
Exemplo n.º 8
0
 /**
  * Constructor.
  *
  * @param KernelInterface  $kernel           A KernelInterface instance
  * @param EmbeddedComposer $embeddedComposer Composer Class Loader
  */
 public function __construct(KernelInterface $kernel, EmbeddedComposer $embeddedComposer)
 {
     $this->kernel = $kernel;
     $this->embeddedComposer = $embeddedComposer;
     if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
         date_default_timezone_set(@date_default_timezone_get());
     }
     $version = $embeddedComposer->findPackage('sculpin/sculpin')->getPrettyVersion();
     if ($version !== Sculpin::GIT_VERSION && Sculpin::GIT_VERSION !== '@' . 'git_version' . '@') {
         $version .= ' (' . Sculpin::GIT_VERSION . ')';
     }
     parent::__construct('Sculpin', $version . ' - ' . $kernel->getName() . '/' . $kernel->getEnvironment() . ($kernel->isDebug() ? '/debug' : ''));
     $this->getDefinition()->addOption(new InputOption('--project-dir', null, InputOption::VALUE_REQUIRED, 'The project directory.', '.'));
     $this->getDefinition()->addOption(new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', $kernel->getEnvironment()));
     $this->getDefinition()->addOption(new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'));
     $this->getDefinition()->addOption(new InputOption('--safe', null, InputOption::VALUE_NONE, 'Enable safe mode (no bundles loaded, no kernel booted)'));
     $this->getDefinition()->addOption(new InputOption('--git-version', null, InputOption::VALUE_NONE, 'See Git version'));
 }
    /**
     * @param KernelInterface $parent
     * @param string          $namespace
     * @param string          $parentClass
     * @param string          $warmupDir
     *
     * @return KernelInterface
     */
    protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
    {
        $rootDir = $parent->getRootDir();
        // the temp kernel class name must have the same length than the real one
        // to avoid the many problems in serialized resources files
        $class = substr($parentClass, 0, -1) . '_';
        // the temp kernel name must be changed too
        $name = substr($parent->getName(), 0, -1) . '_';
        $code = <<<EOF
<?php

namespace {$namespace}
{
    class {$class} extends {$parentClass}
    {
        public function getCacheDir()
        {
            return '{$warmupDir}';
        }

        public function getName()
        {
            return '{$name}';
        }

        public function getRootDir()
        {
            return '{$rootDir}';
        }
    }
}
EOF;
        $this->getContainer()->get('filesystem')->mkdir($warmupDir);
        file_put_contents($file = $warmupDir . '/kernel.tmp', $code);
        require_once $file;
        @unlink($file);
        $class = "{$namespace}\\{$class}";
        return new $class($parent->getEnvironment(), $parent->isDebug());
    }
    /**
     * @param KernelInterface $parent
     * @param string          $namespace
     * @param string          $parentClass
     * @param string          $warmupDir
     *
     * @return KernelInterface
     */
    protected function getTempKernel(KernelInterface $parent, $namespace, $parentClass, $warmupDir)
    {
        $cacheDir = var_export($warmupDir, true);
        $rootDir = var_export(realpath($parent->getRootDir()), true);
        $logDir = var_export(realpath($parent->getLogDir()), true);
        // the temp kernel class name must have the same length than the real one
        // to avoid the many problems in serialized resources files
        $class = substr($parentClass, 0, -1) . '_';
        // the temp kernel name must be changed too
        $name = var_export(substr($parent->getName(), 0, -1) . '_', true);
        $code = <<<EOF
<?php

namespace {$namespace}
{
    class {$class} extends {$parentClass}
    {
        public function getCacheDir()
        {
            return {$cacheDir};
        }

        public function getName()
        {
            return {$name};
        }

        public function getRootDir()
        {
            return {$rootDir};
        }

        public function getLogDir()
        {
            return {$logDir};
        }

        protected function buildContainer()
        {
            \$container = parent::buildContainer();

            // filter container's resources, removing reference to temp kernel file
            \$resources = \$container->getResources();
            \$filteredResources = array();
            foreach (\$resources as \$resource) {
                if ((string) \$resource !== __FILE__) {
                    \$filteredResources[] = \$resource;
                }
            }

            \$container->setResources(\$filteredResources);

            return \$container;
        }
    }
}
EOF;
        $this->getContainer()->get('filesystem')->mkdir($warmupDir);
        file_put_contents($file = $warmupDir . '/kernel.tmp', $code);
        require_once $file;
        $class = "{$namespace}\\{$class}";
        return new $class($parent->getEnvironment(), $parent->isDebug());
    }
Exemplo n.º 11
0
 /**
  * {@inheritdoc}
  */
 public function getName()
 {
     return $this->kernel->getName();
 }