From 12d2bf5ac6d485c5b2b7a748750b16f98cb5b208 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Mon, 6 Mar 2023 22:34:28 +0000 Subject: [PATCH 1/7] Remove forbidden @author tag --- app/code/Magento/Captcha/Block/Captcha.php | 2 -- app/code/Magento/Captcha/Helper/Adminhtml/Data.php | 2 -- app/code/Magento/Captcha/Model/Config/Font.php | 2 -- app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php | 2 -- app/code/Magento/Captcha/Model/Config/Form/Backend.php | 2 -- app/code/Magento/Captcha/Model/Config/Form/Frontend.php | 2 -- app/code/Magento/Captcha/Model/Config/Mode.php | 2 -- app/code/Magento/Captcha/Model/ResourceModel/Log.php | 2 -- app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php | 2 -- .../Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php | 2 -- app/code/Magento/Cms/Block/Widget/Block.php | 2 -- app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php | 2 -- 12 files changed, 24 deletions(-) diff --git a/app/code/Magento/Captcha/Block/Captcha.php b/app/code/Magento/Captcha/Block/Captcha.php index 3bb7ec9ee3896..ed94de7dc635e 100644 --- a/app/code/Magento/Captcha/Block/Captcha.php +++ b/app/code/Magento/Captcha/Block/Captcha.php @@ -6,8 +6,6 @@ /** * Captcha block - * - * @author Magento Core Team */ namespace Magento\Captcha\Block; diff --git a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php index adf8b7df39d87..477b321f4a02b 100644 --- a/app/code/Magento/Captcha/Helper/Adminhtml/Data.php +++ b/app/code/Magento/Captcha/Helper/Adminhtml/Data.php @@ -6,8 +6,6 @@ /** * Captcha helper for adminhtml area - * - * @author Magento Core Team */ namespace Magento\Captcha\Helper\Adminhtml; diff --git a/app/code/Magento/Captcha/Model/Config/Font.php b/app/code/Magento/Captcha/Model/Config/Font.php index cce57e6ced81a..19e664f4ef910 100644 --- a/app/code/Magento/Captcha/Model/Config/Font.php +++ b/app/code/Magento/Captcha/Model/Config/Font.php @@ -6,8 +6,6 @@ /** * Captcha image model - * - * @author Magento Core Team */ namespace Magento\Captcha\Model\Config; diff --git a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php index 811e455af534a..77ae14459524d 100644 --- a/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php +++ b/app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php @@ -6,8 +6,6 @@ /** * Data source to fill "Forms" field - * - * @author Magento Core Team */ namespace Magento\Captcha\Model\Config\Form; diff --git a/app/code/Magento/Captcha/Model/Config/Form/Backend.php b/app/code/Magento/Captcha/Model/Config/Form/Backend.php index 9fad494277cbf..a041c384622e4 100644 --- a/app/code/Magento/Captcha/Model/Config/Form/Backend.php +++ b/app/code/Magento/Captcha/Model/Config/Form/Backend.php @@ -6,8 +6,6 @@ /** * Captcha image model - * - * @author Magento Core Team */ namespace Magento\Captcha\Model\Config\Form; diff --git a/app/code/Magento/Captcha/Model/Config/Form/Frontend.php b/app/code/Magento/Captcha/Model/Config/Form/Frontend.php index 84c1a0018b6cd..78f7b41425be3 100644 --- a/app/code/Magento/Captcha/Model/Config/Form/Frontend.php +++ b/app/code/Magento/Captcha/Model/Config/Form/Frontend.php @@ -6,8 +6,6 @@ /** * Captcha image model - * - * @author Magento Core Team */ namespace Magento\Captcha\Model\Config\Form; diff --git a/app/code/Magento/Captcha/Model/Config/Mode.php b/app/code/Magento/Captcha/Model/Config/Mode.php index b1f0239e73537..cdca976946cd1 100644 --- a/app/code/Magento/Captcha/Model/Config/Mode.php +++ b/app/code/Magento/Captcha/Model/Config/Mode.php @@ -6,8 +6,6 @@ /** * Captcha image model - * - * @author Magento Core Team */ namespace Magento\Captcha\Model\Config; diff --git a/app/code/Magento/Captcha/Model/ResourceModel/Log.php b/app/code/Magento/Captcha/Model/ResourceModel/Log.php index 83d055da7c26d..69fd717ca836f 100644 --- a/app/code/Magento/Captcha/Model/ResourceModel/Log.php +++ b/app/code/Magento/Captcha/Model/ResourceModel/Log.php @@ -7,8 +7,6 @@ /** * Log Attempts resource - * - * @author Magento Core Team */ class Log extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php index 32d36a1869958..5d74c4d142fe8 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php @@ -7,8 +7,6 @@ /** * CMS page chooser for Wysiwyg CMS widget - * - * @author Magento Core Team */ class Chooser extends \Magento\Backend\Block\Widget\Grid\Extended { diff --git a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php index 51a1f8662a012..7da91ed3da035 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php @@ -7,8 +7,6 @@ /** * New directory block for Wysiwyg Images - * - * @author Magento Core Team */ class Newfolder extends \Magento\Backend\Block\Template { diff --git a/app/code/Magento/Cms/Block/Widget/Block.php b/app/code/Magento/Cms/Block/Widget/Block.php index c665f2afc5d38..977b24c989951 100644 --- a/app/code/Magento/Cms/Block/Widget/Block.php +++ b/app/code/Magento/Cms/Block/Widget/Block.php @@ -15,8 +15,6 @@ /** * Cms Static Block Widget - * - * @author Magento Core Team */ class Block extends \Magento\Framework\View\Element\Template implements BlockInterface, IdentityInterface { diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index 5dedc7a1a8395..46d5f484ea613 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -7,8 +7,6 @@ /** * Images manage controller for Cms WYSIWYG editor - * - * @author Magento Core Team */ abstract class Images extends \Magento\Backend\App\Action { From 9f829bf549ec0e8fc188da0124727e81ad6ba635 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 14 Mar 2023 17:44:20 +0000 Subject: [PATCH 2/7] Fix static test failures --- app/code/Magento/Captcha/Block/Captcha.php | 7 ++-- .../Magento/Captcha/Model/Config/Font.php | 2 -- .../Captcha/Model/ResourceModel/Log.php | 6 ++-- app/code/Magento/Cms/Block/Widget/Block.php | 32 ++++++++----------- .../Controller/Adminhtml/Wysiwyg/Images.php | 4 +-- 5 files changed, 18 insertions(+), 33 deletions(-) diff --git a/app/code/Magento/Captcha/Block/Captcha.php b/app/code/Magento/Captcha/Block/Captcha.php index ed94de7dc635e..f1c975dff45b8 100644 --- a/app/code/Magento/Captcha/Block/Captcha.php +++ b/app/code/Magento/Captcha/Block/Captcha.php @@ -4,20 +4,17 @@ * See COPYING.txt for license details. */ -/** - * Captcha block - */ namespace Magento\Captcha\Block; /** + * Captcha block + * * @api * @since 100.0.2 */ class Captcha extends \Magento\Framework\View\Element\Template { /** - * Captcha data - * * @var \Magento\Captcha\Helper\Data */ protected $_captchaData = null; diff --git a/app/code/Magento/Captcha/Model/Config/Font.php b/app/code/Magento/Captcha/Model/Config/Font.php index 19e664f4ef910..793ea05a5d6db 100644 --- a/app/code/Magento/Captcha/Model/Config/Font.php +++ b/app/code/Magento/Captcha/Model/Config/Font.php @@ -12,8 +12,6 @@ class Font implements \Magento\Framework\Option\ArrayInterface { /** - * Captcha data - * * @var \Magento\Captcha\Helper\Data */ protected $_captchaData = null; diff --git a/app/code/Magento/Captcha/Model/ResourceModel/Log.php b/app/code/Magento/Captcha/Model/ResourceModel/Log.php index 69fd717ca836f..df1c94d66eafa 100644 --- a/app/code/Magento/Captcha/Model/ResourceModel/Log.php +++ b/app/code/Magento/Captcha/Model/ResourceModel/Log.php @@ -13,16 +13,14 @@ class Log extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb /** * Remote Address log type */ - const TYPE_REMOTE_ADDRESS = 1; + public const TYPE_REMOTE_ADDRESS = 1; /** * Type User Login Name */ - const TYPE_LOGIN = 2; + public const TYPE_LOGIN = 2; /** - * Core Date - * * @var \Magento\Framework\Stdlib\DateTime\DateTime */ protected $_coreDate; diff --git a/app/code/Magento/Cms/Block/Widget/Block.php b/app/code/Magento/Cms/Block/Widget/Block.php index 977b24c989951..f0891e752553d 100644 --- a/app/code/Magento/Cms/Block/Widget/Block.php +++ b/app/code/Magento/Cms/Block/Widget/Block.php @@ -31,8 +31,6 @@ class Block extends \Magento\Framework\View\Element\Template implements BlockInt protected static $_widgetUsageMap = []; /** - * Block factory - * * @var \Magento\Cms\Model\BlockFactory */ protected $_blockFactory; @@ -75,19 +73,18 @@ protected function _beforeToHtml() if (isset(self::$_widgetUsageMap[$blockHash])) { return $this; } + self::$_widgetUsageMap[$blockHash] = true; $block = $this->getBlock(); if ($block && $block->isActive()) { - try { - $storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId(); - $this->setText( - $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()) - ); - } catch (NoSuchEntityException $e) { - } + $storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId(); + $this->setText( + $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()) + ); } + unset(self::$_widgetUsageMap[$blockHash]); return $this; } @@ -122,16 +119,13 @@ private function getBlock(): ?CmsBlock $blockId = $this->getData('block_id'); if ($blockId) { - try { - $storeId = $this->_storeManager->getStore()->getId(); - /** @var \Magento\Cms\Model\Block $block */ - $block = $this->_blockFactory->create(); - $block->setStoreId($storeId)->load($blockId); - $this->block = $block; - - return $block; - } catch (NoSuchEntityException $e) { - } + $storeId = $this->_storeManager->getStore()->getId(); + /** @var \Magento\Cms\Model\Block $block */ + $block = $this->_blockFactory->create(); + $block->setStoreId($storeId)->load($blockId); + $this->block = $block; + + return $block; } return null; diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index 46d5f484ea613..3fda92b9117cc 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -15,11 +15,9 @@ abstract class Images extends \Magento\Backend\App\Action * * @see _isAllowed() */ - const ADMIN_RESOURCE = 'Magento_Cms::media_gallery'; + public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery'; /** - * Core registry - * * @var \Magento\Framework\Registry */ protected $_coreRegistry = null; From 521ce6156b02b20f1ee48b7570f2845609a56e87 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Tue, 14 Mar 2023 17:45:46 +0000 Subject: [PATCH 3/7] Fix static test failure --- app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php index 5d74c4d142fe8..4748e319790e2 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php @@ -63,7 +63,7 @@ public function __construct( protected function _construct() { parent::_construct(); - //$this->setDefaultSort('name'); + $this->setUseAjax(true); $this->setDefaultFilter(['chooser_is_active' => '1']); } From 20b7a3145cf7fd43f3f5cb550df0f2469b3a1d9c Mon Sep 17 00:00:00 2001 From: engcom-Dash Date: Fri, 29 Nov 2024 17:22:33 +0530 Subject: [PATCH 4/7] 36980: fix static failure --- app/code/Magento/Captcha/Block/Captcha.php | 5 ++--- app/code/Magento/Captcha/Helper/Adminhtml/Data.php | 6 ++++-- app/code/Magento/Captcha/Model/Config/Font.php | 4 ++-- app/code/Magento/Captcha/Model/Config/Form/AbstractForm.php | 4 ++-- app/code/Magento/Captcha/Model/Config/Form/Backend.php | 4 ++-- app/code/Magento/Captcha/Model/Config/Form/Frontend.php | 4 ++-- app/code/Magento/Captcha/Model/Config/Mode.php | 4 ++-- app/code/Magento/Captcha/Model/ResourceModel/Log.php | 5 +++-- .../Magento/Cms/Block/Adminhtml/Page/Widget/Chooser.php | 5 +++-- .../Block/Adminhtml/Wysiwyg/Images/Content/Newfolder.php | 5 +++-- app/code/Magento/Cms/Block/Widget/Block.php | 5 ++--- 11 files changed, 27 insertions(+), 24 deletions(-) diff --git a/app/code/Magento/Captcha/Block/Captcha.php b/app/code/Magento/Captcha/Block/Captcha.php index f1c975dff45b8..430c4ecca5d6d 100644 --- a/app/code/Magento/Captcha/Block/Captcha.php +++ b/app/code/Magento/Captcha/Block/Captcha.php @@ -1,9 +1,8 @@ Date: Fri, 29 Nov 2024 17:24:00 +0530 Subject: [PATCH 5/7] 36980: fix static failure in remaining file --- app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php index 3fda92b9117cc..d08b67c57d2a0 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images.php @@ -1,8 +1,9 @@ Date: Fri, 29 Nov 2024 17:30:16 +0530 Subject: [PATCH 6/7] 36980: add a new line after copyright tag --- app/code/Magento/Captcha/Block/Captcha.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Captcha/Block/Captcha.php b/app/code/Magento/Captcha/Block/Captcha.php index 430c4ecca5d6d..198d43f5bcb7e 100644 --- a/app/code/Magento/Captcha/Block/Captcha.php +++ b/app/code/Magento/Captcha/Block/Captcha.php @@ -3,6 +3,7 @@ * Copyright 2012 Adobe * All Rights Reserved. */ + namespace Magento\Captcha\Block; /** From 8d3b15476597efbd327e9bf935a38c64c18e518e Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Fri, 13 Dec 2024 17:50:06 +0000 Subject: [PATCH 7/7] Restore try/catch blocks with empty catch --- app/code/Magento/Cms/Block/Widget/Block.php | 28 +++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/Cms/Block/Widget/Block.php b/app/code/Magento/Cms/Block/Widget/Block.php index acd4c5e4a389f..dd603580bdc31 100644 --- a/app/code/Magento/Cms/Block/Widget/Block.php +++ b/app/code/Magento/Cms/Block/Widget/Block.php @@ -78,10 +78,13 @@ protected function _beforeToHtml() $block = $this->getBlock(); if ($block && $block->isActive()) { - $storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId(); - $this->setText( - $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()) - ); + try { + $storeId = $this->getData('store_id') ?? $this->_storeManager->getStore()->getId(); + $this->setText( + $this->_filterProvider->getBlockFilter()->setStoreId($storeId)->filter($block->getContent()) + ); + } catch (NoSuchEntityException $e) { // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch + } } unset(self::$_widgetUsageMap[$blockHash]); @@ -118,13 +121,16 @@ private function getBlock(): ?CmsBlock $blockId = $this->getData('block_id'); if ($blockId) { - $storeId = $this->_storeManager->getStore()->getId(); - /** @var \Magento\Cms\Model\Block $block */ - $block = $this->_blockFactory->create(); - $block->setStoreId($storeId)->load($blockId); - $this->block = $block; - - return $block; + try { + $storeId = $this->_storeManager->getStore()->getId(); + /** @var \Magento\Cms\Model\Block $block */ + $block = $this->_blockFactory->create(); + $block->setStoreId($storeId)->load($blockId); + $this->block = $block; + + return $block; + } catch (NoSuchEntityException $e) { // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch + } } return null;