From fda9e6ecbb18717c036d472c236344effcf323b3 Mon Sep 17 00:00:00 2001 From: Oleksandr Gorbivskyi Date: Mon, 27 Feb 2023 10:41:33 -0800 Subject: [PATCH 01/14] MCLOUD-10032: Added ACSD-49067 patch - Auto increment number jumping up for catalog_product_entity_* tables --- patches.json | 3 ++ ...alog_product_entity_tables__2.4.3-p1.patch | 48 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch diff --git a/patches.json b/patches.json index 87558fd..73a56d1 100644 --- a/patches.json +++ b/patches.json @@ -264,6 +264,9 @@ }, "Fixed currency displaying on product page": { ">=2.4.3 <2.4.4": "MCLOUD-8279__Fixed_currency_displaying_on_product_page__2.4.3.patch" + }, + "Auto increment number jumping up for catalog_product_entity_* tables": { + ">=2.3.7 <2.4.7": "MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch" } }, "magento/module-paypal": { diff --git a/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch b/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch new file mode 100644 index 0000000..40d2d31 --- /dev/null +++ b/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch @@ -0,0 +1,48 @@ +diff --git a/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php b/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php +index c71225b4fc6..3f0ee96d70e 100644 +--- a/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php ++++ b/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php +@@ -24,14 +24,14 @@ use Magento\Eav\Model\Entity\Attribute\UniqueValidationInterface; + abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity + { + /** +- * Store manager ++ * Store manager to get the store information + * + * @var \Magento\Store\Model\StoreManagerInterface + */ + protected $_storeManager; + + /** +- * Model factory ++ * Model factory to create a model object + * + * @var \Magento\Catalog\Model\Factory + */ +@@ -325,7 +325,25 @@ abstract class AbstractResource extends \Magento\Eav\Model\Entity\AbstractEntity + */ + protected function _updateAttribute($object, $attribute, $valueId, $value) + { +- return $this->_saveAttributeValue($object, $attribute, $value); ++ $entity = $attribute->getEntity(); ++ $row = $this->getAttributeRow($entity, $object, $attribute); ++ $hasSingleStore = $this->_storeManager->hasSingleStore(); ++ $storeId = $hasSingleStore ++ ? $this->getDefaultStoreId() ++ : (int) $this->_storeManager->getStore($object->getStoreId())->getId(); ++ if ($valueId > 0 && array_key_exists('store_id', $row) && $storeId === $row['store_id']) { ++ $table = $attribute->getBackend()->getTable(); ++ $connection = $this->getConnection(); ++ $connection->update( ++ $table, ++ ['value' => $this->_prepareValueForSave($value, $attribute)], ++ sprintf('%s=%d', $connection->quoteIdentifier('value_id'), $valueId) ++ ); ++ ++ return $this; ++ } else { ++ return $this->_saveAttributeValue($object, $attribute, $value); ++ } + } + + /** From e6e1405c1e6f46d149008cd7f1a6c54f81c9844a Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 28 Feb 2023 12:09:16 -0600 Subject: [PATCH 02/14] Update MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch --- ...ent_number_for_catalog_product_entity_tables__2.4.3-p1.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch b/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch index 40d2d31..8ec7378 100644 --- a/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch +++ b/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch @@ -1,4 +1,4 @@ -diff --git a/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php b/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php +diff -Nuar a/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php b/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php index c71225b4fc6..3f0ee96d70e 100644 --- a/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php +++ b/vendor/magento/module-catalog/Model/ResourceModel/AbstractResource.php From 854a060a9e3ee132b549026e1902c9417b1d4f9b Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Tue, 11 Apr 2023 19:10:59 -0500 Subject: [PATCH 03/14] MCLOUD-10279: Added ACSD-50165 patch --- patches.json | 3 ++ ...shing_js_css_cache_from_admin__2.4.4.patch | 28 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch diff --git a/patches.json b/patches.json index 87558fd..439edae 100644 --- a/patches.json +++ b/patches.json @@ -264,6 +264,9 @@ }, "Fixed currency displaying on product page": { ">=2.4.3 <2.4.4": "MCLOUD-8279__Fixed_currency_displaying_on_product_page__2.4.3.patch" + }, + "Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": { + ">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch" } }, "magento/module-paypal": { diff --git a/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch new file mode 100644 index 0000000..548c211 --- /dev/null +++ b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch @@ -0,0 +1,28 @@ +diff --git a/vendor/magento/framework/Filesystem/Driver/File.php b/vendor/magento/framework/Filesystem/Driver/File.php +index 5dcfeeef23ab..e26acb5a9369 100644 +--- a/vendor/magento/framework/Filesystem/Driver/File.php ++++ b/vendor/magento/framework/Filesystem/Driver/File.php +@@ -440,11 +440,12 @@ public function symlink($source, $destination, DriverInterface $targetDriver = n + */ + public function deleteFile($path) + { +- $result = @unlink($this->getScheme() . $path); ++ @unlink($this->getScheme() . $path); + if ($this->stateful) { + clearstatcache(true, $this->getScheme() . $path); + } +- if (!$result) { ++ ++ if ($this->isFile($path)) { + throw new FileSystemException( + new Phrase( + 'The "%1" file can\'t be deleted. %2', +@@ -452,7 +453,7 @@ public function deleteFile($path) + ) + ); + } +- return $result; ++ return true; + } + + /** From ac798faa61c921a6caf750c4712008f67b0e2ede Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Wed, 12 Apr 2023 13:51:38 -0500 Subject: [PATCH 04/14] MCLOUD-10279: Added ACSD-50284 patch --- patches.json | 1 + ...shing_js_css_cache_from_admin__2.4.0.patch | 24 +++++++++++++++++++ ...shing_js_css_cache_from_admin__2.4.4.patch | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch diff --git a/patches.json b/patches.json index 439edae..598c66e 100644 --- a/patches.json +++ b/patches.json @@ -266,6 +266,7 @@ ">=2.4.3 <2.4.4": "MCLOUD-8279__Fixed_currency_displaying_on_product_page__2.4.3.patch" }, "Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": { + ">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch" ">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch" } }, diff --git a/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch new file mode 100644 index 0000000..8cc5480 --- /dev/null +++ b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch @@ -0,0 +1,24 @@ +diff -Nuar a/vendor/magento/framework/Filesystem/Driver/File.php b/vendor/magento/framework/Filesystem/Driver/File.php +index 1affad552137..4edb095f6c48 100644 +--- a/vendor/magento/framework/Filesystem/Driver/File.php ++++ b/vendor/magento/framework/Filesystem/Driver/File.php +@@ -391,8 +391,8 @@ public function symlink($source, $destination, DriverInterface $targetDriver = n + */ + public function deleteFile($path) + { +- $result = @unlink($this->getScheme() . $path); +- if (!$result) { ++ @unlink($this->getScheme() . $path); ++ if ($this->isFile($path)) { + throw new FileSystemException( + new Phrase( + 'The "%1" file can\'t be deleted. %2', +@@ -400,7 +400,7 @@ public function deleteFile($path) + ) + ); + } +- return $result; ++ return true; + } + + /** diff --git a/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch index 548c211..8cbc276 100644 --- a/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch +++ b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch @@ -1,4 +1,4 @@ -diff --git a/vendor/magento/framework/Filesystem/Driver/File.php b/vendor/magento/framework/Filesystem/Driver/File.php +diff -Nuar a/vendor/magento/framework/Filesystem/Driver/File.php b/vendor/magento/framework/Filesystem/Driver/File.php index 5dcfeeef23ab..e26acb5a9369 100644 --- a/vendor/magento/framework/Filesystem/Driver/File.php +++ b/vendor/magento/framework/Filesystem/Driver/File.php From 17be5c74d6c1fc64c66d523408a0328881d7f826 Mon Sep 17 00:00:00 2001 From: Kateryna Muntianu Date: Thu, 20 Apr 2023 08:02:11 -0500 Subject: [PATCH 05/14] Update for MCLOUD-10279 --- patches.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches.json b/patches.json index 8fb9884..63300fd 100644 --- a/patches.json +++ b/patches.json @@ -269,7 +269,7 @@ ">=2.3.7 <2.4.7": "MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch" }, "Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": { - ">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch" + ">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch", ">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch" } }, From 5d8f506511da07ff707f054a4788c2fe5544678d Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Thu, 25 May 2023 16:07:26 -0500 Subject: [PATCH 06/14] ACP2E-1963: Add warning to the QPT CLI wizard/output in case patch has dependencies --- .../Process/Action/ConfirmRequiredAction.php | 10 +++++++++- src/Command/Process/Renderer.php | 5 +++++ src/Command/Process/ShowStatus.php | 5 +++-- src/Patch/AggregatedPatchFactory.php | 17 ++++++++++++++++- src/Patch/Collector/SupportCollector.php | 12 ++++++++++-- src/Patch/Data/AggregatedPatch.php | 16 +++++++++++++++- src/Patch/Data/AggregatedPatchInterface.php | 7 +++++++ src/Patch/Data/Patch.php | 18 +++++++++++++++++- src/Patch/Data/PatchInterface.php | 7 +++++++ src/Patch/PatchBuilder.php | 19 ++++++++++++++++++- src/Test/Unit/Patch/PatchBuilderTest.php | 8 ++++++-- 11 files changed, 113 insertions(+), 11 deletions(-) diff --git a/src/Command/Process/Action/ConfirmRequiredAction.php b/src/Command/Process/Action/ConfirmRequiredAction.php index a8d7462..c0a935d 100644 --- a/src/Command/Process/Action/ConfirmRequiredAction.php +++ b/src/Command/Process/Action/ConfirmRequiredAction.php @@ -21,6 +21,8 @@ */ class ConfirmRequiredAction implements ActionInterface { + const PATCH_INFO_URL = "https://experienceleague.adobe.com/tools/commerce-quality-patches/index.html"; + /** * @var OptionalPool */ @@ -76,10 +78,16 @@ function ($patch) { } if ($requiredNotAppliedPatches) { + $url = self::PATCH_INFO_URL . '?keyword=' . current($patchFilter); + $output->writeln( + 'Please double check patch details and requirements at ' . + sprintf('%1$s', $url) . + '' . + PHP_EOL + ); $output->writeln( 'Next patches are required by ' . implode(' ', $patchFilter) . ':' . PHP_EOL ); - $aggregatedPatches = $this->aggregator->aggregate($requiredNotAppliedPatches); $this->renderer->printTable($output, $aggregatedPatches); diff --git a/src/Command/Process/Renderer.php b/src/Command/Process/Renderer.php index 3ba1055..8162a4e 100644 --- a/src/Command/Process/Renderer.php +++ b/src/Command/Process/Renderer.php @@ -220,6 +220,11 @@ function ($item) { $details .= 'Affected components:' . $glue . implode($glue, $patch->getAffectedComponents()); } + if ($patch->getRequirements()) { + $requirements = rtrim(chunk_split($patch->getRequirements(), 50, PHP_EOL)); + $details .= PHP_EOL . 'Requirements:' . PHP_EOL . ' - ' . $requirements; + } + $id = $patch->getType() === PatchInterface::TYPE_CUSTOM ? 'N/A' : $patch->getId(); $title = chunk_split($patch->getTitle(), 60, PHP_EOL); diff --git a/src/Command/Process/ShowStatus.php b/src/Command/Process/ShowStatus.php index d013aa4..ad5ae6a 100644 --- a/src/Command/Process/ShowStatus.php +++ b/src/Command/Process/ShowStatus.php @@ -284,8 +284,9 @@ private function getPatchCategories(array $patches): array */ private function printDetailsInfo(OutputInterface $output) { - $supportUrl = 'https://support.magento.com'; - $releaseNotesUrl = 'https://devdocs.magento.com/quality-patches/release-notes.html'; + // phpcs:ignore + $releaseNotesUrl = 'https://experienceleague.adobe.com/docs/commerce-operations/tools/quality-patches-tool/release-notes.html'; + $supportUrl = 'https://experienceleague.adobe.com/tools/commerce-quality-patches/index.html'; $output->writeln( 'Patch details you can find on ' . diff --git a/src/Patch/AggregatedPatchFactory.php b/src/Patch/AggregatedPatchFactory.php index fcc0bd7..d58495c 100644 --- a/src/Patch/AggregatedPatchFactory.php +++ b/src/Patch/AggregatedPatchFactory.php @@ -36,6 +36,7 @@ public function create( $require = $this->getRequire($items); $replacedWith = $this->getReplacedWith($items); $isDeprecated = $this->isDeprecated($items); + $requirements = $this->getRequirements($items); return new AggregatedPatch( $id, @@ -47,7 +48,8 @@ public function create( $require, $replacedWith, $isDeprecated, - $items + $items, + $requirements ); } @@ -189,4 +191,17 @@ private function isDeprecated(array $patches): bool return false; } + + /** + * Returns aggregated patch requirements. + * + * @param PatchInterface[] $patches + * @return string + */ + private function getRequirements(array $patches): string + { + $patch = reset($patches); + + return $patch->getRequirements(); + } } diff --git a/src/Patch/Collector/SupportCollector.php b/src/Patch/Collector/SupportCollector.php index 16d17dd..91d1345 100644 --- a/src/Patch/Collector/SupportCollector.php +++ b/src/Patch/Collector/SupportCollector.php @@ -55,6 +55,8 @@ class SupportCollector implements CollectorInterface const ORIGIN = 'Adobe Commerce Support'; + const PROP_REQUIREMENTS = 'requirements'; + /** * @var Package */ @@ -113,6 +115,7 @@ public function collect(): array $category = !empty($patchGeneralConfig[self::PROP_CATEGORIES]) ? array_map('trim', $patchGeneralConfig[self::PROP_CATEGORIES]) : ['Other']; + $patchRequirements = $patchGeneralConfig[self::PROP_REQUIREMENTS] ?? ''; if ($this->package->matchConstraint($packageName, $packageConstraint)) { $result[] = $this->createPatch( @@ -124,7 +127,8 @@ public function collect(): array $packageConstraint, $patchRequire, $patchReplacedWith, - $patchDeprecated + $patchDeprecated, + $patchRequirements ); } } @@ -145,9 +149,11 @@ public function collect(): array * @param array $patchRequire * @param string $patchReplacedWith * @param bool $patchDeprecated + * @param string $patchRequirements * * @return PatchInterface * @throws CollectorException + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ private function createPatch( string $patchId, @@ -158,7 +164,8 @@ private function createPatch( string $packageConstraint, array $patchRequire, string $patchReplacedWith, - bool $patchDeprecated + bool $patchDeprecated, + string $patchRequirements ): PatchInterface { try { $patchPath = $this->qualityPackage->getPatchesDirectoryPath() . '/' . $patchFile; @@ -174,6 +181,7 @@ private function createPatch( $this->patchBuilder->setRequire($patchRequire); $this->patchBuilder->setReplacedWith($patchReplacedWith); $this->patchBuilder->setDeprecated($patchDeprecated); + $this->patchBuilder->setRequirements($patchRequirements); $patch = $this->patchBuilder->build(); } catch (PatchIntegrityException $e) { throw new CollectorException($e->getMessage(), $e->getCode(), $e); diff --git a/src/Patch/Data/AggregatedPatch.php b/src/Patch/Data/AggregatedPatch.php index f4d0bea..c80e4ce 100644 --- a/src/Patch/Data/AggregatedPatch.php +++ b/src/Patch/Data/AggregatedPatch.php @@ -62,6 +62,11 @@ class AggregatedPatch implements AggregatedPatchInterface */ private $origin; + /** + * @var string + */ + private $requirements; + /** * @param string $id * @param string $type @@ -85,7 +90,8 @@ public function __construct( array $require, string $replacedWith, bool $isDeprecated, - array $items + array $items, + string $requirements ) { $this->id = $id; @@ -98,6 +104,7 @@ public function __construct( $this->replacedWith = $replacedWith; $this->isDeprecated = $isDeprecated; $this->items = $items; + $this->requirements = $requirements; } /** @@ -187,4 +194,11 @@ public function getItems(): array { return $this->items; } + /** + * @inheritDoc + */ + public function getRequirements(): string + { + return $this->requirements; + } } diff --git a/src/Patch/Data/AggregatedPatchInterface.php b/src/Patch/Data/AggregatedPatchInterface.php index 8f65cb4..f58db7b 100644 --- a/src/Patch/Data/AggregatedPatchInterface.php +++ b/src/Patch/Data/AggregatedPatchInterface.php @@ -83,4 +83,11 @@ public function isDeprecated(): bool; * @return PatchInterface[] */ public function getItems(): array; + + /** + * Patch requirements. + * + * @return string + */ + public function getRequirements(): string; } diff --git a/src/Patch/Data/Patch.php b/src/Patch/Data/Patch.php index a35966e..0124689 100644 --- a/src/Patch/Data/Patch.php +++ b/src/Patch/Data/Patch.php @@ -76,6 +76,11 @@ class Patch implements PatchInterface */ private $origin; + /** + * @var string + */ + private $requirements; + /** * @param string $id * @param string $type @@ -90,6 +95,7 @@ class Patch implements PatchInterface * @param string[] $require * @param string $replacedWith * @param bool $isDeprecated + * @param string $requirements * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -106,7 +112,8 @@ public function __construct( array $affectedComponents, array $require, string $replacedWith, - bool $isDeprecated + bool $isDeprecated, + string $requirements ) { $this->id = $id; @@ -122,6 +129,7 @@ public function __construct( $this->require = $require; $this->replacedWith = $replacedWith; $this->isDeprecated = $isDeprecated; + $this->requirements = $requirements; } /** @@ -235,4 +243,12 @@ public function isDeprecated(): bool { return $this->isDeprecated; } + + /** + * @inheritDoc + */ + public function getRequirements(): string + { + return $this->requirements; + } } diff --git a/src/Patch/Data/PatchInterface.php b/src/Patch/Data/PatchInterface.php index 6d5d7cd..3955311 100644 --- a/src/Patch/Data/PatchInterface.php +++ b/src/Patch/Data/PatchInterface.php @@ -119,4 +119,11 @@ public function getReplacedWith(): string; * @return bool */ public function isDeprecated(): bool; + + /** + * Patch requirements. + * + * @return string + */ + public function getRequirements(): string; } diff --git a/src/Patch/PatchBuilder.php b/src/Patch/PatchBuilder.php index cbfd2d2..2babc8a 100644 --- a/src/Patch/PatchBuilder.php +++ b/src/Patch/PatchBuilder.php @@ -84,6 +84,11 @@ class PatchBuilder */ private $filesystem; + /** + * @var string + */ + private $requirements; + /** * @param Filesystem $filesystem */ @@ -226,6 +231,17 @@ public function setDeprecated(bool $deprecated) $this->deprecated = $deprecated; } + /** + * Sets patch requirements. + * + * @param string $requirements + * @return void + */ + public function setRequirements(string $requirements) + { + $this->requirements = $requirements; + } + /** * Builds patch data object. * @@ -250,7 +266,8 @@ public function build() $components, $this->require, $this->replacedWith, - $this->deprecated + $this->deprecated, + $this->requirements ); } diff --git a/src/Test/Unit/Patch/PatchBuilderTest.php b/src/Test/Unit/Patch/PatchBuilderTest.php index 908f88d..b607c10 100644 --- a/src/Test/Unit/Patch/PatchBuilderTest.php +++ b/src/Test/Unit/Patch/PatchBuilderTest.php @@ -57,7 +57,8 @@ public function testBuild() 'packageConstraint' => '2.3.5', 'require' => ['MC-2'], 'replacedWith' => 'MC-3', - 'deprecated' => true + 'deprecated' => true, + 'requirements'=> 'Some requirements' ]; $patchContent = file_get_contents(__DIR__ . '/Fixture/MC-1__testfixture__1.1.patch'); @@ -76,6 +77,7 @@ public function testBuild() $this->assertEquals($patch->getRequire(), $patchData['require']); $this->assertEquals($patch->getReplacedWith(), $patchData['replacedWith']); $this->assertEquals($patch->isDeprecated(), $patchData['deprecated']); + $this->assertEquals($patch->getRequirements(), $patchData['requirements']); $this->assertEquals( ['magento/framework', 'magento/module-email', 'setup/src'], $patch->getAffectedComponents() @@ -99,7 +101,8 @@ public function testBuildWithException() 'packageConstraint' => '2.3.5', 'require' => ['MC-2'], 'replacedWith' => 'MC-3', - 'deprecated' => true + 'deprecated' => true, + 'requirements'=> 'Some requirements' ]; $this->filesystem->method('get') @@ -129,6 +132,7 @@ private function buildPatch(array $patchData): PatchInterface $this->patchBuilder->setRequire($patchData['require']); $this->patchBuilder->setReplacedWith($patchData['replacedWith']); $this->patchBuilder->setDeprecated($patchData['deprecated']); + $this->patchBuilder->setRequirements($patchData['requirements']); return $this->patchBuilder->build(); } From 4be72873e9bd6881cf332431c48d2c5e060838cf Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Thu, 25 May 2023 19:20:26 -0500 Subject: [PATCH 07/14] ACP2E-1963: Add warning to the QPT CLI wizard/output in case patch has dependencies --- src/Patch/Data/Patch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Patch/Data/Patch.php b/src/Patch/Data/Patch.php index 0124689..5e1deb4 100644 --- a/src/Patch/Data/Patch.php +++ b/src/Patch/Data/Patch.php @@ -79,7 +79,7 @@ class Patch implements PatchInterface /** * @var string */ - private $requirements; + private $requirements = ''; /** * @param string $id @@ -113,7 +113,7 @@ public function __construct( array $require, string $replacedWith, bool $isDeprecated, - string $requirements + string $requirements = '' ) { $this->id = $id; From a75ef2ad8e7294563b5723af25a6eef0bb312902 Mon Sep 17 00:00:00 2001 From: Viktor Tymchynskyi Date: Thu, 25 May 2023 21:29:29 -0500 Subject: [PATCH 08/14] ACP2E-1963: Add warning to the QPT CLI wizard/output in case patch has dependencies --- src/Patch/Data/AggregatedPatch.php | 4 ++-- src/Patch/PatchBuilder.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Patch/Data/AggregatedPatch.php b/src/Patch/Data/AggregatedPatch.php index c80e4ce..883ec49 100644 --- a/src/Patch/Data/AggregatedPatch.php +++ b/src/Patch/Data/AggregatedPatch.php @@ -65,7 +65,7 @@ class AggregatedPatch implements AggregatedPatchInterface /** * @var string */ - private $requirements; + private $requirements = ''; /** * @param string $id @@ -91,7 +91,7 @@ public function __construct( string $replacedWith, bool $isDeprecated, array $items, - string $requirements + string $requirements = '' ) { $this->id = $id; diff --git a/src/Patch/PatchBuilder.php b/src/Patch/PatchBuilder.php index 2babc8a..b7bc9e2 100644 --- a/src/Patch/PatchBuilder.php +++ b/src/Patch/PatchBuilder.php @@ -87,7 +87,7 @@ class PatchBuilder /** * @var string */ - private $requirements; + private $requirements = ''; /** * @param Filesystem $filesystem From 81c36518d4c06345a613e015a8a653af1dd38efe Mon Sep 17 00:00:00 2001 From: Andrii Poltoratskyi Date: Tue, 30 May 2023 11:18:41 -0700 Subject: [PATCH 09/14] MCLOUD-10604: Added ACSD-51892 patch --- patches.json | 3 + ...ound_deployment_configuration__2.4.6.patch | 134 ++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch diff --git a/patches.json b/patches.json index 63300fd..5710cea 100644 --- a/patches.json +++ b/patches.json @@ -271,6 +271,9 @@ "Fixes the error 'The file can't be deleted. Warning!unlink: No such file or directory' when flushing JS/CSS cache from the Admin": { ">=2.4.0 <2.4.1-p1": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.0.patch", ">=2.4.1-p1 <2.4.7": "MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch" + }, + "Reduced the number of times the same deployment configurations load": { + ">=2.4.6 <2.4.7": "MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch" } }, "magento/module-paypal": { diff --git a/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch b/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch new file mode 100644 index 0000000..15fb704 --- /dev/null +++ b/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch @@ -0,0 +1,134 @@ +diff -Nuar a/vendor/magento/framework/App/DeploymentConfig.php b/vendor/magento/framework/App/DeploymentConfig.php +index 6713baa3a1d..64f32d5516b 100644 +--- a/vendor/magento/framework/App/DeploymentConfig.php ++++ b/vendor/magento/framework/App/DeploymentConfig.php +@@ -51,6 +51,16 @@ class DeploymentConfig + */ + private $overrideData; + ++ /** ++ * @var array ++ */ ++ private $envOverrides = []; ++ ++ /** ++ * @var array ++ */ ++ private $readerLoad = []; ++ + /** + * Constructor + * +@@ -84,7 +94,9 @@ class DeploymentConfig + } + $result = $this->getByKey($key); + if ($result === null) { +- $this->reloadData(); ++ if (empty($this->flatData) || count($this->getAllEnvOverrides())) { ++ $this->reloadData(); ++ } + $result = $this->getByKey($key); + } + return $result ?? $defaultValue; +@@ -114,13 +126,13 @@ class DeploymentConfig + { + if ($key === null) { + if (empty($this->data)) { +- $this->reloadData(); ++ $this->reloadInitialData(); + } + return $this->data; + } + $result = $this->getConfigDataByKey($key); + if ($result === null) { +- $this->reloadData(); ++ $this->reloadInitialData(); + $result = $this->getConfigDataByKey($key); + } + return $result; +@@ -170,28 +182,55 @@ class DeploymentConfig + * @throws FileSystemException + * @throws RuntimeException + */ +- private function reloadData(): void ++ private function reloadInitialData(): void + { ++ if (empty($this->readerLoad) || empty($this->data) || empty($this->flatData)) { ++ $this->readerLoad = $this->reader->load(); ++ } + $this->data = array_replace( +- $this->reader->load(), ++ $this->readerLoad, + $this->overrideData ?? [], + $this->getEnvOverride() + ); ++ } ++ ++ /** ++ * Loads the configuration data ++ * ++ * @return void ++ * @throws FileSystemException ++ * @throws RuntimeException ++ */ ++ private function reloadData(): void ++ { ++ $this->reloadInitialData(); + // flatten data for config retrieval using get() + $this->flatData = $this->flattenParams($this->data); ++ $this->flatData = $this->getAllEnvOverrides() + $this->flatData; ++ } + +- // allow reading values from env variables by convention +- // MAGENTO_DC_{path}, like db/connection/default/host => +- // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST +- foreach (getenv() as $key => $value) { +- if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX) +- && $key !== self::OVERRIDE_KEY +- ) { +- // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host +- $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key)); +- $this->flatData[$flatKey] = $value; ++ /** ++ * Load all getenv() configs once ++ * ++ * @return array ++ */ ++ private function getAllEnvOverrides(): array ++ { ++ if (empty($this->envOverrides)) { ++ // allow reading values from env variables by convention ++ // MAGENTO_DC_{path}, like db/connection/default/host => ++ // can be overwritten by MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST ++ foreach (getenv() as $key => $value) { ++ if (false !== \strpos($key, self::MAGENTO_ENV_PREFIX) ++ && $key !== self::OVERRIDE_KEY ++ ) { ++ // convert MAGENTO_DC_DB__CONNECTION__DEFAULT__HOST into db/connection/default/host ++ $flatKey = strtolower(str_replace([self::MAGENTO_ENV_PREFIX, '__'], ['', '/'], $key)); ++ $this->envOverrides[$flatKey] = $value; ++ } + } + } ++ return $this->envOverrides; + } + + /** +diff -Nuar a/vendor/magento/framework/Module/ModuleList.php b/vendor/magento/framework/Module/ModuleList.php +index b3cf433bbaf..32e2d2b1550 100644 +--- a/vendor/magento/framework/Module/ModuleList.php ++++ b/vendor/magento/framework/Module/ModuleList.php +@@ -140,8 +140,11 @@ class ModuleList implements ModuleListInterface + */ + private function loadConfigData() + { +- if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) { +- $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); ++ if (null === $this->configData) { ++ $config = $this->config->get(ConfigOptionsListConstants::KEY_MODULES); ++ if (null !== $config) { ++ $this->configData = $config; ++ } + } + } + } \ No newline at end of file From 51402859250e91ba317092ebefa88e39a70daab1 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 1 Jun 2023 14:41:54 -0500 Subject: [PATCH 10/14] MCLOUD-10226: Fix regexp cache tag validation --- patches.json | 5 ++ ...x_regexp_cache_tag_validation__2.4.6.patch | 46 +++++++++++++++++++ .../Functional/Acceptance/AcceptanceCest.php | 3 +- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch diff --git a/patches.json b/patches.json index 63300fd..68e0a85 100644 --- a/patches.json +++ b/patches.json @@ -396,5 +396,10 @@ ">=2.3.4-p2 <2.3.7-p3 || >=2.4.0 <2.4.3": "MDVA-43443__parser_token_new_fix__2.3.4-p2.patch", ">=2.4.3 <2.4.3-p2": "MDVA-43443__parser_token_new_fix__2.4.3.patch" } + }, + "magento/framework": { + "Fix regexp cache tag validation": { + ">=103.0.6 <103.0.7": "MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch" + } } } diff --git a/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch b/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch new file mode 100644 index 0000000..9f29d05 --- /dev/null +++ b/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch @@ -0,0 +1,46 @@ +diff -Nuar a/lib/internal/Magento/Framework/Cache/Core.php b/lib/internal/Magento/Framework/Cache/Core.php +--- a/lib/internal/Magento/Framework/Cache/Core.php ++++ b/lib/internal/Magento/Framework/Cache/Core.php +@@ -5,6 +5,10 @@ + */ + namespace Magento\Framework\Cache; + ++use Magento\Framework\Cache\Backend\Redis; ++use Zend_Cache; ++use Zend_Cache_Exception; ++ + class Core extends \Zend_Cache_Core + { + /** +@@ -126,6 +130,34 @@ public function getIdsNotMatchingTags($tags = []) + return parent::getIdsNotMatchingTags($tags); + } + ++ /** ++ * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...) ++ * ++ * Throw an exception if a problem is found ++ * ++ * @param string $string Cache id or tag ++ * @throws Zend_Cache_Exception ++ * @return void ++ */ ++ protected function _validateIdOrTag($string) ++ { ++ if ($this->_backend instanceof Redis) { ++ if (!is_string($string)) { ++ Zend_Cache::throwException('Invalid id or tag : must be a string'); ++ } ++ if (substr($string, 0, 9) == 'internal-') { ++ Zend_Cache::throwException('"internal-*" ids or tags are reserved'); ++ } ++ if (!preg_match('~^[a-zA-Z0-9_{}]+$~D', $string)) { ++ Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_{}]"); ++ } ++ ++ return; ++ } ++ ++ parent::_validateIdOrTag($string); ++ } ++ diff --git a/src/Test/Functional/Acceptance/AcceptanceCest.php b/src/Test/Functional/Acceptance/AcceptanceCest.php index 762775f..139dbf2 100644 --- a/src/Test/Functional/Acceptance/AcceptanceCest.php +++ b/src/Test/Functional/Acceptance/AcceptanceCest.php @@ -49,7 +49,8 @@ public function testPatches(\CliTester $I, \Codeception\Example $data): void protected function patchesDataProvider(): array { return [ - ['templateVersion' => '2.4.6', 'magentoVersion' => null], + ['templateVersion' => '2.4.6', 'magentoVersion' => '2.4.6'], + ['templateVersion' => '2.4.6', 'magentoVersion' => '2.4.6-p1'], ]; } } From 440222a2c1659dfcfdc76c3e1e79441c4a1a2cab Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 6 Jun 2023 14:28:19 -0500 Subject: [PATCH 11/14] MCLOUD-10226: Fix regexp cache tag validation --- ...x_regexp_cache_tag_validation__2.4.6.patch | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch b/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch index 9f29d05..c6777a6 100644 --- a/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch +++ b/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch @@ -1,7 +1,7 @@ -diff -Nuar a/lib/internal/Magento/Framework/Cache/Core.php b/lib/internal/Magento/Framework/Cache/Core.php ---- a/lib/internal/Magento/Framework/Cache/Core.php -+++ b/lib/internal/Magento/Framework/Cache/Core.php -@@ -5,6 +5,10 @@ +diff -Naur a/vendor/magento/framework/Cache/Core.php b/vendor/magento/framework/Cache/Core.php +--- a/vendor/magento/framework/Cache/Core.php 2023-02-23 14:11:04 ++++ b/vendor/magento/framework/Cache/Core.php 2023-04-14 11:54:58 +@@ -5,6 +5,10 @@ namespace Magento\Framework\Cache; */ namespace Magento\Framework\Cache; @@ -12,10 +12,12 @@ diff -Nuar a/lib/internal/Magento/Framework/Cache/Core.php b/lib/internal/Magent class Core extends \Zend_Cache_Core { /** -@@ -126,6 +130,34 @@ public function getIdsNotMatchingTags($tags = []) +@@ -124,6 +128,34 @@ class Core extends \Zend_Cache_Core + { + $tags = $this->_tags($tags); return parent::getIdsNotMatchingTags($tags); - } - ++ } ++ + /** + * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...) + * @@ -42,5 +44,6 @@ diff -Nuar a/lib/internal/Magento/Framework/Cache/Core.php b/lib/internal/Magent + } + + parent::_validateIdOrTag($string); -+ } -+ + } + + /** From 1cc7c09c1d8e0dce0f102a08046a5f8da4ff379e Mon Sep 17 00:00:00 2001 From: Andrii Poltoratskyi Date: Mon, 12 Jun 2023 09:39:51 -0700 Subject: [PATCH 12/14] MCLOUD-10604: Added an empty line --- ...nce_degradation_around_deployment_configuration__2.4.6.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch b/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch index 15fb704..0f63865 100644 --- a/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch +++ b/patches/MCLOUD-10604__performance_degradation_around_deployment_configuration__2.4.6.patch @@ -131,4 +131,4 @@ index b3cf433bbaf..32e2d2b1550 100644 + } } } - } \ No newline at end of file + } From 9ab92390a8cdabeda177c8af68202ed496ca0335 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 15 Jun 2023 10:10:01 -0500 Subject: [PATCH 13/14] MCLOUD-10674: Release MCP 1.0.22 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3ab197f..d5c7a7b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "magento/magento-cloud-patches", "description": "Provides critical fixes for Magento 2 Enterprise Edition", "type": "magento2-component", - "version": "1.0.21", + "version": "1.0.22", "license": "OSL-3.0", "repositories": { "repo.magento.com": { From 36d0994b34dea2776a47e24e661bb4a6299082a9 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Thu, 15 Jun 2023 10:13:27 -0500 Subject: [PATCH 14/14] MCLOUD-10674: Update FT --- src/Test/Functional/Acceptance/Acceptance81Cest.php | 1 + src/Test/Functional/Acceptance/AcceptanceCest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Test/Functional/Acceptance/Acceptance81Cest.php b/src/Test/Functional/Acceptance/Acceptance81Cest.php index ac0f702..49ffd69 100644 --- a/src/Test/Functional/Acceptance/Acceptance81Cest.php +++ b/src/Test/Functional/Acceptance/Acceptance81Cest.php @@ -22,6 +22,7 @@ protected function patchesDataProvider(): array ['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p1'], ['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p2'], ['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p3'], + ['templateVersion' => '2.4.4', 'magentoVersion' => '2.4.4-p4'], ['templateVersion' => '2.4.5', 'magentoVersion' => '2.4.5'], ['templateVersion' => '2.4.5', 'magentoVersion' => '2.4.5-p1'], ['templateVersion' => '2.4.5', 'magentoVersion' => '2.4.5-p2'], diff --git a/src/Test/Functional/Acceptance/AcceptanceCest.php b/src/Test/Functional/Acceptance/AcceptanceCest.php index 139dbf2..79cd321 100644 --- a/src/Test/Functional/Acceptance/AcceptanceCest.php +++ b/src/Test/Functional/Acceptance/AcceptanceCest.php @@ -51,6 +51,7 @@ protected function patchesDataProvider(): array return [ ['templateVersion' => '2.4.6', 'magentoVersion' => '2.4.6'], ['templateVersion' => '2.4.6', 'magentoVersion' => '2.4.6-p1'], + ['templateVersion' => '2.4.7-beta', 'magentoVersion' => null], ]; } }