From 1672a8344ae2323513fbfffebebfd64dd1de3194 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Tue, 15 Sep 2015 09:57:25 +0100 Subject: [PATCH 1/2] [WebProfilerBundle] removed import/export commands --- .../Bundle/WebProfilerBundle/CHANGELOG.md | 5 + .../Command/ExportCommand.php | 81 ---------------- .../Command/ImportCommand.php | 96 ------------------- .../Resources/config/commands.xml | 18 ---- 4 files changed, 5 insertions(+), 195 deletions(-) delete mode 100644 src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php delete mode 100644 src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php delete mode 100644 src/Symfony/Bundle/WebProfilerBundle/Resources/config/commands.xml diff --git a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md index 5a319e7eff784..b0cf847a7fb37 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +3.0.0 +----- + + * removed profiler:import and profiler:export commands + 2.8.0 ----- diff --git a/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php b/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php deleted file mode 100644 index 57e201e32be4c..0000000000000 --- a/src/Symfony/Bundle/WebProfilerBundle/Command/ExportCommand.php +++ /dev/null @@ -1,81 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebProfilerBundle\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\HttpKernel\Profiler\Profiler; - -/** - * Exports a profile. - * - * @deprecated since version 2.8, to be removed in 3.0. - * - * @author Fabien Potencier - */ -class ExportCommand extends Command -{ - private $profiler; - - public function __construct(Profiler $profiler = null) - { - $this->profiler = $profiler; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - public function isEnabled() - { - if (null === $this->profiler) { - return false; - } - - return parent::isEnabled(); - } - - protected function configure() - { - $this - ->setName('profiler:export') - ->setDescription('[DEPRECATED] Exports a profile') - ->setDefinition(array( - new InputArgument('token', InputArgument::REQUIRED, 'The profile token'), - )) - ->setHelp(<<%command.name% command exports a profile to the standard output: - - php %command.full_name% profile_token -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $formatter = $this->getHelper('formatter'); - - $output->writeln($formatter->formatSection('warning', 'The profiler:export command is deprecated since version 2.8 and will be removed in 3.0', 'comment')); - - $token = $input->getArgument('token'); - - if (!$profile = $this->profiler->loadProfile($token)) { - throw new \LogicException(sprintf('Profile with token "%s" does not exist.', $token)); - } - - $output->writeln($this->profiler->export($profile), OutputInterface::OUTPUT_RAW); - } -} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php b/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php deleted file mode 100644 index 850d79c051d9d..0000000000000 --- a/src/Symfony/Bundle/WebProfilerBundle/Command/ImportCommand.php +++ /dev/null @@ -1,96 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bundle\WebProfilerBundle\Command; - -use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\HttpKernel\Profiler\Profiler; - -/** - * Imports a profile. - * - * @deprecated since version 2.8, to be removed in 3.0. - * - * @author Fabien Potencier - */ -class ImportCommand extends Command -{ - private $profiler; - - public function __construct(Profiler $profiler = null) - { - $this->profiler = $profiler; - - parent::__construct(); - } - - /** - * {@inheritdoc} - */ - public function isEnabled() - { - if (null === $this->profiler) { - return false; - } - - return parent::isEnabled(); - } - - protected function configure() - { - $this - ->setName('profiler:import') - ->setDescription('[DEPRECATED] Imports a profile') - ->setDefinition(array( - new InputArgument('filename', InputArgument::OPTIONAL, 'The profile path'), - )) - ->setHelp(<<%command.name% command imports a profile: - - php %command.full_name% profile_filepath - -You can also pipe the profile via STDIN: - - cat profile_file | php %command.full_name% -EOF - ) - ; - } - - protected function execute(InputInterface $input, OutputInterface $output) - { - $formatter = $this->getHelper('formatter'); - - $output->writeln($formatter->formatSection('warning', 'The profiler:import command is deprecated since version 2.8 and will be removed in 3.0', 'comment')); - - $data = ''; - if ($input->getArgument('filename')) { - $data = file_get_contents($input->getArgument('filename')); - } else { - if (0 !== ftell(STDIN)) { - throw new \RuntimeException('Please provide a filename or pipe the profile to STDIN.'); - } - - while (!feof(STDIN)) { - $data .= fread(STDIN, 1024); - } - } - - if (!$profile = $this->profiler->import($data)) { - throw new \LogicException('The profile already exists in the database.'); - } - - $output->writeln(sprintf('Profile "%s" has been successfully imported.', $profile->getToken())); - } -} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/commands.xml b/src/Symfony/Bundle/WebProfilerBundle/Resources/config/commands.xml deleted file mode 100644 index d29a5a1cae909..0000000000000 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/config/commands.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - From c1d028e73dbe31c1ff1098c4f4f046e7c569de0b Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Tue, 15 Sep 2015 08:57:35 +0100 Subject: [PATCH 2/2] [HttpKernel] removed Profiler::import/export --- src/Symfony/Component/HttpKernel/CHANGELOG.md | 2 + .../HttpKernel/Profiler/Profiler.php | 40 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/src/Symfony/Component/HttpKernel/CHANGELOG.md b/src/Symfony/Component/HttpKernel/CHANGELOG.md index 324444fc6527e..5ca85c6760d71 100644 --- a/src/Symfony/Component/HttpKernel/CHANGELOG.md +++ b/src/Symfony/Component/HttpKernel/CHANGELOG.md @@ -24,6 +24,8 @@ CHANGELOG * removed `Symfony\Component\HttpKernel\HttpCache\EsiResponseCacheStrategyInterface` * removed `Symfony\Component\HttpKernel\Log\LoggerInterface` * removed `Symfony\Component\HttpKernel\Log\NullLogger` + * removed `Symfony\Component\HttpKernel\Profiler::import()` + * removed `Symfony\Component\HttpKernel\Profiler::export()` 2.8.0 ----- diff --git a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php index 378bf5dac3e8a..8373a151b5d62 100644 --- a/src/Symfony/Component/HttpKernel/Profiler/Profiler.php +++ b/src/Symfony/Component/HttpKernel/Profiler/Profiler.php @@ -131,46 +131,6 @@ public function purge() $this->storage->purge(); } - /** - * Exports the current profiler data. - * - * @param Profile $profile A Profile instance - * - * @return string The exported data - * - * @deprecated since Symfony 2.8, to be removed in 3.0. - */ - public function export(Profile $profile) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); - - return base64_encode(serialize($profile)); - } - - /** - * Imports data into the profiler storage. - * - * @param string $data A data string as exported by the export() method - * - * @return Profile A Profile instance - * - * @deprecated since Symfony 2.8, to be removed in 3.0. - */ - public function import($data) - { - @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED); - - $profile = unserialize(base64_decode($data)); - - if ($this->storage->read($profile->getToken())) { - return false; - } - - $this->saveProfile($profile); - - return $profile; - } - /** * Finds profiler tokens for the given criteria. *