![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-theme/Controller/Adminhtml/System/Design/Theme/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Theme\Controller\Adminhtml\System\Design\Theme; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\Controller\ResultFactory; use Magento\Theme\Controller\Adminhtml\System\Design\Theme; /** * The admin area controller to delete theme. * * @deprecated 100.2.0 */ class Delete extends Theme implements HttpGetActionInterface { /** * Delete action * * @return \Magento\Backend\Model\View\Result\Redirect */ public function execute() { $themeId = $this->getRequest()->getParam('id'); try { if ($themeId) { /** @var $theme \Magento\Framework\View\Design\ThemeInterface */ $theme = $this->_objectManager->create( \Magento\Framework\View\Design\ThemeInterface::class )->load($themeId); if (!$theme->getId()) { throw new \InvalidArgumentException(__( 'We cannot find a theme with id "%1".', $themeId )->render()); } if (!$theme->isVirtual()) { throw new \InvalidArgumentException( sprintf('Only virtual theme is possible to delete and theme "%s" isn\'t virtual', $themeId) ); } $theme->delete(); $this->messageManager->addSuccess(__('You deleted the theme.')); } } catch (\Magento\Framework\Exception\LocalizedException $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('We cannot delete the theme.')); $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e); } $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); return $resultRedirect->setPath('adminhtml/*/'); } }