Skip to content

Commit

Permalink
Merge pull request #80 from magento-commerce/develop
Browse files Browse the repository at this point in the history
MCLOUD-10674: Release MCP 1.0.22
  • Loading branch information
BaDos authored Jun 19, 2023
2 parents 9b0aeb2 + 7dae97f commit 7587503
Show file tree
Hide file tree
Showing 20 changed files with 416 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
15 changes: 15 additions & 0 deletions patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -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);
+ }
}

/**
49 changes: 49 additions & 0 deletions patches/MCLOUD-10226__fix_regexp_cache_tag_validation__2.4.6.patch
Original file line number Diff line number Diff line change
@@ -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);
}

/**
Original file line number Diff line number Diff line change
@@ -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;
}

/**
Original file line number Diff line number Diff line change
@@ -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;
}

/**
Original file line number Diff line number Diff line change
@@ -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;
+ }
}
}
}
10 changes: 9 additions & 1 deletion src/Command/Process/Action/ConfirmRequiredAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
class ConfirmRequiredAction implements ActionInterface
{
const PATCH_INFO_URL = "https://experienceleague.adobe.com/tools/commerce-quality-patches/index.html";

/**
* @var OptionalPool
*/
Expand Down Expand Up @@ -76,10 +78,16 @@ function ($patch) {
}

if ($requiredNotAppliedPatches) {
$url = self::PATCH_INFO_URL . '?keyword=' . current($patchFilter);
$output->writeln(
'<info>Please double check patch details and requirements at ' .
sprintf('<href=%1$s>%1$s</>', $url) .
'</info>' .
PHP_EOL
);
$output->writeln(
'<info>Next patches are required by ' . implode(' ', $patchFilter) . ':</info>' . PHP_EOL
);

$aggregatedPatches = $this->aggregator->aggregate($requiredNotAppliedPatches);
$this->renderer->printTable($output, $aggregatedPatches);

Expand Down
5 changes: 5 additions & 0 deletions src/Command/Process/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '<comment>Requirements:</comment>' . PHP_EOL . ' - ' . $requirements;
}

$id = $patch->getType() === PatchInterface::TYPE_CUSTOM ? 'N/A' : $patch->getId();
$title = chunk_split($patch->getTitle(), 60, PHP_EOL);

Expand Down
5 changes: 3 additions & 2 deletions src/Command/Process/ShowStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
'<info>Patch details you can find on </info>' .
Expand Down
Loading

0 comments on commit 7587503

Please sign in to comment.