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'); }
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'); }
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'); }
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'); }
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>"); } }