Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Magento\Setup\Console\Command; use Magento\Framework\App\Console\Maintena..

Decoded Output download

<?php
 namespace Magento\Setup\Console\Command; use Magento\Framework\App\Console\MaintenanceModeEnabler; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\MaintenanceMode; use Magento\Framework\Backup\Factory; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Setup\BackupRollbackFactory; use Magento\Setup\Model\ObjectManagerProvider; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class RollbackCommand extends AbstractSetupCommand { const INPUT_KEY_CODE_BACKUP_FILE = "code-file"; const INPUT_KEY_MEDIA_BACKUP_FILE = "media-file"; const INPUT_KEY_DB_BACKUP_FILE = "db-file"; private $objectManager; private $backupRollbackFactory; private $deploymentConfig; private $maintenanceModeEnabler; public function __construct(ObjectManagerProvider $objectManagerProvider, MaintenanceMode $maintenanceMode, DeploymentConfig $deploymentConfig, MaintenanceModeEnabler $maintenanceModeEnabler = null) { $this->objectManager = $objectManagerProvider->get(); $this->backupRollbackFactory = $this->objectManager->get(\Magento\Framework\Setup\BackupRollbackFactory::class); $this->deploymentConfig = $deploymentConfig; $this->maintenanceModeEnabler = $maintenanceModeEnabler ?: $this->objectManager->get(MaintenanceModeEnabler::class); parent::__construct(); } protected function configure() { $options = array(new InputOption(self::INPUT_KEY_CODE_BACKUP_FILE, "c", InputOption::VALUE_REQUIRED, "Basename of the code backup file in var/backups"), new InputOption(self::INPUT_KEY_MEDIA_BACKUP_FILE, "m", InputOption::VALUE_REQUIRED, "Basename of the media backup file in var/backups"), new InputOption(self::INPUT_KEY_DB_BACKUP_FILE, "d", InputOption::VALUE_REQUIRED, "Basename of the db backup file in var/backups")); $this->setName("setup:rollback")->setDescription("Rolls back Magento Application codebase, media and database")->setDefinition($options); parent::configure(); } protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->deploymentConfig->isAvailable() && ($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE) || $input->getOption(self::INPUT_KEY_DB_BACKUP_FILE))) { $output->writeln("<info>No information is available: the Magento application is not installed.</info>"); return \Magento\Framework\Console\Cli::RETURN_FAILURE; } return $this->maintenanceModeEnabler->executeInMaintenanceMode(function () use($input, $output) { try { $helper = $this->getHelper("question"); $question = new ConfirmationQuestion("<info>You are about to remove current code and/or database tables. Are you sure?[y/N]<info>", false); if (!$helper->ask($input, $output, $question) && $input->isInteractive()) { return \Magento\Framework\Console\Cli::RETURN_FAILURE; } $questionKeep = new ConfirmationQuestion("<info>Do you want to keep the backups?[y/N]<info>", false); $keepSourceFile = $helper->ask($input, $output, $questionKeep); $this->doRollback($input, $output, $keepSourceFile); $output->writeln("<info>Please set file permission of bin/magento to executable</info>"); return \Magento\Framework\Console\Cli::RETURN_SUCCESS; } catch (\Exception $e) { $output->writeln("<error>" . $e->getMessage() . "</error>"); return \Magento\Framework\Console\Cli::RETURN_FAILURE; } }, $output, false); } private function doRollback(InputInterface $input, OutputInterface $output, $keepSourceFile) { $inputOptionProvided = false; $rollbackHandler = $this->backupRollbackFactory->create($output); if ($input->getOption(self::INPUT_KEY_CODE_BACKUP_FILE)) { $rollbackHandler->codeRollback($input->getOption(self::INPUT_KEY_CODE_BACKUP_FILE), Factory::TYPE_FILESYSTEM, $keepSourceFile); $inputOptionProvided = true; } if ($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE)) { $rollbackHandler->codeRollback($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE), Factory::TYPE_MEDIA, $keepSourceFile); $inputOptionProvided = true; } if ($input->getOption(self::INPUT_KEY_DB_BACKUP_FILE)) { $this->setAreaCode(); $rollbackHandler->dbRollback($input->getOption(self::INPUT_KEY_DB_BACKUP_FILE), $keepSourceFile); $inputOptionProvided = true; } if (!$inputOptionProvided) { throw new \InvalidArgumentException("Not enough information provided to roll back."); } } private function setAreaCode() { $areaCode = "adminhtml"; $appState = $this->objectManager->get(\Magento\Framework\App\State::class); $appState->setAreaCode($areaCode); $configLoader = $this->objectManager->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class); $this->objectManager->configure($configLoader->load($areaCode)); } } ?>

Did this file decode correctly?

Original Code

<?php
 namespace Magento\Setup\Console\Command; use Magento\Framework\App\Console\MaintenanceModeEnabler; use Magento\Framework\App\DeploymentConfig; use Magento\Framework\App\MaintenanceMode; use Magento\Framework\Backup\Factory; use Magento\Framework\ObjectManagerInterface; use Magento\Framework\Setup\BackupRollbackFactory; use Magento\Setup\Model\ObjectManagerProvider; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; class RollbackCommand extends AbstractSetupCommand { const INPUT_KEY_CODE_BACKUP_FILE = "\143\x6f\144\145\55\x66\x69\154\145"; const INPUT_KEY_MEDIA_BACKUP_FILE = "\155\145\x64\x69\x61\55\x66\151\x6c\145"; const INPUT_KEY_DB_BACKUP_FILE = "\x64\142\x2d\146\x69\154\145"; private $objectManager; private $backupRollbackFactory; private $deploymentConfig; private $maintenanceModeEnabler; public function __construct(ObjectManagerProvider $objectManagerProvider, MaintenanceMode $maintenanceMode, DeploymentConfig $deploymentConfig, MaintenanceModeEnabler $maintenanceModeEnabler = null) { $this->objectManager = $objectManagerProvider->get(); $this->backupRollbackFactory = $this->objectManager->get(\Magento\Framework\Setup\BackupRollbackFactory::class); $this->deploymentConfig = $deploymentConfig; $this->maintenanceModeEnabler = $maintenanceModeEnabler ?: $this->objectManager->get(MaintenanceModeEnabler::class); parent::__construct(); } protected function configure() { $options = array(new InputOption(self::INPUT_KEY_CODE_BACKUP_FILE, "\x63", InputOption::VALUE_REQUIRED, "\102\141\x73\x65\x6e\x61\x6d\x65\40\x6f\146\x20\x74\x68\145\x20\x63\x6f\144\145\40\x62\x61\x63\153\165\160\40\146\151\x6c\145\x20\151\x6e\x20\x76\141\x72\x2f\142\141\143\x6b\x75\160\x73"), new InputOption(self::INPUT_KEY_MEDIA_BACKUP_FILE, "\x6d", InputOption::VALUE_REQUIRED, "\102\141\163\x65\x6e\141\155\145\40\157\x66\40\x74\150\x65\x20\155\x65\144\151\141\x20\x62\x61\143\153\165\x70\x20\x66\151\154\x65\x20\151\156\40\166\141\162\57\x62\141\143\x6b\x75\160\x73"), new InputOption(self::INPUT_KEY_DB_BACKUP_FILE, "\144", InputOption::VALUE_REQUIRED, "\102\141\163\145\156\141\x6d\x65\x20\x6f\146\40\164\x68\145\40\x64\x62\x20\142\x61\143\153\x75\160\40\x66\151\x6c\145\x20\151\x6e\x20\166\x61\162\x2f\142\141\143\153\x75\x70\x73")); $this->setName("\163\x65\x74\165\160\72\162\x6f\x6c\x6c\x62\141\143\153")->setDescription("\x52\x6f\154\154\163\40\142\x61\x63\x6b\40\x4d\141\x67\145\156\164\157\x20\101\160\x70\154\x69\x63\141\164\151\157\156\40\x63\x6f\x64\145\142\141\x73\x65\54\40\x6d\x65\144\x69\x61\40\141\x6e\x64\40\144\141\x74\141\x62\141\163\145")->setDefinition($options); parent::configure(); } protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->deploymentConfig->isAvailable() && ($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE) || $input->getOption(self::INPUT_KEY_DB_BACKUP_FILE))) { $output->writeln("\x3c\151\x6e\146\x6f\76\x4e\157\40\151\156\x66\x6f\162\x6d\x61\x74\151\x6f\x6e\40\x69\x73\40\x61\166\x61\x69\154\141\x62\x6c\x65\x3a\x20\x74\x68\145\x20\x4d\141\x67\x65\156\x74\157\x20\x61\160\x70\x6c\x69\143\x61\x74\x69\x6f\x6e\x20\x69\163\40\x6e\157\164\40\x69\156\163\x74\x61\154\154\145\x64\56\x3c\x2f\151\156\x66\x6f\76"); return \Magento\Framework\Console\Cli::RETURN_FAILURE; } return $this->maintenanceModeEnabler->executeInMaintenanceMode(function () use($input, $output) { try { $helper = $this->getHelper("\x71\x75\x65\163\x74\x69\157\156"); $question = new ConfirmationQuestion("\x3c\151\x6e\146\x6f\x3e\x59\157\165\x20\141\162\145\x20\x61\142\x6f\165\164\x20\x74\x6f\40\162\145\155\157\x76\x65\40\x63\165\x72\162\x65\156\x74\x20\143\x6f\x64\x65\40\141\x6e\144\x2f\x6f\x72\x20\144\x61\164\141\x62\x61\x73\145\x20\164\x61\142\x6c\x65\163\56\40\x41\162\145\x20\x79\x6f\x75\x20\x73\x75\162\x65\77\133\x79\x2f\116\135\x3c\x69\x6e\146\157\x3e", false); if (!$helper->ask($input, $output, $question) && $input->isInteractive()) { return \Magento\Framework\Console\Cli::RETURN_FAILURE; } $questionKeep = new ConfirmationQuestion("\74\151\156\x66\x6f\x3e\x44\x6f\x20\171\157\x75\40\167\x61\156\x74\40\164\157\40\153\145\x65\x70\x20\x74\150\x65\40\x62\141\143\x6b\x75\160\163\77\133\171\57\x4e\x5d\x3c\151\156\x66\157\x3e", false); $keepSourceFile = $helper->ask($input, $output, $questionKeep); $this->doRollback($input, $output, $keepSourceFile); $output->writeln("\x3c\151\x6e\146\x6f\76\120\154\x65\x61\x73\x65\40\x73\145\x74\x20\x66\151\x6c\x65\x20\x70\145\162\x6d\151\163\163\x69\x6f\x6e\40\157\x66\x20\142\x69\x6e\57\155\141\147\x65\156\x74\x6f\40\164\x6f\40\x65\x78\x65\x63\165\164\x61\142\x6c\x65\74\57\151\x6e\x66\157\76"); return \Magento\Framework\Console\Cli::RETURN_SUCCESS; } catch (\Exception $e) { $output->writeln("\x3c\145\x72\x72\x6f\x72\76" . $e->getMessage() . "\74\x2f\145\162\x72\x6f\x72\x3e"); return \Magento\Framework\Console\Cli::RETURN_FAILURE; } }, $output, false); } private function doRollback(InputInterface $input, OutputInterface $output, $keepSourceFile) { $inputOptionProvided = false; $rollbackHandler = $this->backupRollbackFactory->create($output); if ($input->getOption(self::INPUT_KEY_CODE_BACKUP_FILE)) { $rollbackHandler->codeRollback($input->getOption(self::INPUT_KEY_CODE_BACKUP_FILE), Factory::TYPE_FILESYSTEM, $keepSourceFile); $inputOptionProvided = true; } if ($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE)) { $rollbackHandler->codeRollback($input->getOption(self::INPUT_KEY_MEDIA_BACKUP_FILE), Factory::TYPE_MEDIA, $keepSourceFile); $inputOptionProvided = true; } if ($input->getOption(self::INPUT_KEY_DB_BACKUP_FILE)) { $this->setAreaCode(); $rollbackHandler->dbRollback($input->getOption(self::INPUT_KEY_DB_BACKUP_FILE), $keepSourceFile); $inputOptionProvided = true; } if (!$inputOptionProvided) { throw new \InvalidArgumentException("\116\157\x74\40\145\x6e\157\x75\147\x68\40\x69\x6e\146\157\162\x6d\141\x74\151\x6f\156\40\x70\162\157\166\x69\144\145\x64\40\x74\x6f\40\x72\x6f\x6c\x6c\x20\x62\x61\143\x6b\56"); } } private function setAreaCode() { $areaCode = "\141\x64\155\151\156\x68\x74\x6d\x6c"; $appState = $this->objectManager->get(\Magento\Framework\App\State::class); $appState->setAreaCode($areaCode); $configLoader = $this->objectManager->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class); $this->objectManager->configure($configLoader->load($areaCode)); } }

Function Calls

None

Variables

None

Stats

MD5 960252c12ca0036266dc77ee64596871
Eval Count 0
Decode Time 110 ms