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": {
diff --git a/patches.json b/patches.json
index 87558fd..c5044ac 100644
--- a/patches.json
+++ b/patches.json
@@ -264,6 +264,16 @@
},
"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"
+ },
+ "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": {
@@ -389,5 +399,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-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..8ec7378
--- /dev/null
+++ b/patches/MCLOUD-10032__Increment_number_for_catalog_product_entity_tables__2.4.3-p1.patch
@@ -0,0 +1,48 @@
+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
+@@ -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);
++ }
+ }
+
+ /**
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..c6777a6
--- /dev/null
+++ b/patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch
@@ -0,0 +1,49 @@
+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;
+
++use Magento\Framework\Cache\Backend\Redis;
++use Zend_Cache;
++use Zend_Cache_Exception;
++
+ class Core extends \Zend_Cache_Core
+ {
+ /**
+@@ -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...)
++ *
++ * 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/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
new file mode 100644
index 0000000..8cbc276
--- /dev/null
+++ b/patches/MCLOUD-10279__errors_when_flushing_js_css_cache_from_admin__2.4.4.patch
@@ -0,0 +1,28 @@
+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
+@@ -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;
+ }
+
+ /**
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..0f63865
--- /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;
++ }
+ }
+ }
+ }
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..883ec49 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..5e1deb4 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..b7bc9e2 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/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 762775f..79cd321 100644
--- a/src/Test/Functional/Acceptance/AcceptanceCest.php
+++ b/src/Test/Functional/Acceptance/AcceptanceCest.php
@@ -49,7 +49,9 @@ 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'],
+ ['templateVersion' => '2.4.7-beta', 'magentoVersion' => null],
];
}
}
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();
}