コード例 #1
0
ファイル: Ini.php プロジェクト: Radio-Actif/joomla-vagrant
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $key = $input->getArgument('key');
     $value = $input->getArgument('value');
     if ($input->getOption('list-files') || empty($key)) {
         $this->_listIniFiles();
     }
     if (empty($key)) {
         return;
     }
     $current = \Helper\Ini::getPHPConfig($key);
     if ($current === false) {
         $output->writeln("Unknown key '{$key}'");
         return;
     }
     if (empty($current)) {
         $current = 'no value (0 or empty string)';
     }
     if (!is_null($value)) {
         $ini = $this->_getIniOverride();
         if ($ini !== false) {
             \Helper\Ini::update($ini, $key, $value);
             $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart')), $output);
             $output->writeln("{$key} value is now <info>{$value}</info>, was <info>{$current}</info>");
         } else {
             $output->write('Error: failed to find PHP\'s additional config directory (config-file-scan-dir)!');
         }
     } else {
         $output->writeln("{$key} value is <info>{$current}</info>");
     }
 }
コード例 #2
0
ファイル: Enable.php プロジェクト: Radio-Actif/joomla-vagrant
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $files = \Helper\Ini::findIniFiles($this->_ini_files);
     foreach ($files as $file) {
         \Helper\Ini::update($file, 'apc.enabled', '1');
     }
     $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart', 'service' => array('apache'))), $output);
     $output->writeln('APC has been enabled');
 }
コード例 #3
0
ファイル: Enable.php プロジェクト: Radio-Actif/joomla-vagrant
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $files = \Helper\Ini::findIniFiles($this->_ini_files);
     foreach ($files as $file) {
         `sudo sed -i 's#^; zend_extension=#zend_extension=#' {$file}`;
     }
     $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart', 'service' => array('apache'))), new NullOutput());
     $output->writeln('Zend Server Z-Ray has been enabled');
 }
コード例 #4
0
ファイル: Enable.php プロジェクト: Radio-Actif/joomla-vagrant
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if (extension_loaded('xdebug')) {
         $output->writeln('[<comment>notice</comment>] XDebug is already enabled');
         exit;
     }
     $files = \Helper\Ini::findIniFiles($this->_ini_files);
     foreach ($files as $file) {
         `sudo sed -i 's#^; zend_extension=#zend_extension=#' {$file}`;
     }
     $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart', 'service' => array('apache'))), new NullOutput());
     $output->writeln('Xdebug has been enabled');
 }
コード例 #5
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     if (!extension_loaded('xdebug')) {
         $output->writeln('[<comment>notice</comment>] XDebug is already disabled');
         exit;
     }
     $files = \Helper\Ini::findIniFiles($this->_ini_files);
     foreach ($files as $file) {
         `sudo sed -i 's#^zend_extension=#; zend_extension=#' {$file}`;
     }
     // Also disable the profiler so we don't spend
     // an afternoon looking for the lack of performance
     // after enabling xdebug again after three weeks. :)
     $files = \Helper\Ini::findIniFiles(array('custom.ini', '99-custom.ini'), false);
     foreach ($files as $file) {
         \Helper\Ini::update($file, 'xdebug.profiler_enable', 0);
     }
     $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart', 'service' => array('apache'))), new NullOutput());
     $output->writeln('Xdebug has been disabled');
 }
コード例 #6
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $action = strtolower($input->getArgument('action'));
     if (!in_array($action, array('start', 'stop'))) {
         throw new \RuntimeException('Action must be one of start|stop');
     }
     if (!extension_loaded('xdebug') && $action == 'start') {
         $output->writeln('[<comment>notice</comment>] XDebug is not loaded. Enabling ..');
         $this->getApplication()->find('xdebug:enable')->run(new ArrayInput(array('command' => 'xdebug:enable')), new NullOutput());
     }
     $inis = \Helper\Ini::findIniFiles(array('zray.ini'), false);
     $ini = array_pop($inis);
     if ($action == 'start' && file_exists($ini)) {
         $contents = file_get_contents($ini);
         if (preg_match('/^zend_extension\\s*=\\s*.+zray\\.so/', $contents)) {
             $output->writeln('[<comment>warning</comment>] <info>Zend Z-Ray</info> is enabled. This will generate a lot of profiler output!');
             $output->writeln('[<comment>warning</comment>] You can disable <info>Zend Z-Ray</info> with this command: <comment>box zray:disable</comment>');
         }
     }
     $current = \Helper\Ini::getPHPConfig('xdebug.profiler_enable');
     $value = $action == 'start' ? 1 : 0;
     $word = $action == 'start' ? 'started' : 'stopped';
     if ($current == $value) {
         $output->writeln("Profiler has already been {$word}");
         exit;
     }
     $files = \Helper\Ini::findIniFiles(array('custom.ini', '99-custom.ini'), false);
     foreach ($files as $file) {
         \Helper\Ini::update($file, 'xdebug.profiler_enable', $value);
     }
     $this->getApplication()->find('server:restart')->run(new ArrayInput(array('command' => 'server:restart')), new NullOutput());
     $output_dir = \Helper\Ini::getPHPConfig('xdebug.profiler_output_dir');
     $output->writeln("XDebug profiler has been {$word}");
     if ($action == 'start') {
         $output->writeln("Profiling information will be written to <info>{$output_dir}</info>");
     }
 }