-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [Magento Community Engineering] Community Contributions - 2.4-devel…
…op latest changes Accepted Community Pull Requests: - #27179: improve Magento\Catalog\Model\ImageUploader error handler (by @fsw) - #26506: #26499 Always transliterate product url key (by @DanieliMi) - #27145: Cleanup ObjectManager usage - Magento_WebapiAsync (by @Bartlomiejsz) - #26959: Correctly escape custom product image attributes (by @alexander-aleman) - #25722: #25669: fixed issue "health_check.php fails if any database cache engine configured" (by @andrewbess) Fixed GitHub Issues: - #26499: Product url key is not transliterated anymore if already set (reported by @DanieliMi) has been fixed in #26506 by @DanieliMi in 2.4-develop branch Related commits: 1. e9300b7 2. b7dc0be 3. 4e54034 4. 1b3ac06 5. 55c2266 6. 27dd58a - #25219: Custom attributes of images generated by Block\Product\ImageFactory don't render correctly (reported by @chris-pook) has been fixed in #26959 by @alexander-aleman in 2.4-develop branch Related commits: 1. 6a8a103 2. 4d3a05d 3. b0ccd4f 4. 79025f8 5. 5e84595 6. afac7ea 7. c9ad76f 8. 9fa7ece - #25669: health_check.php fails if any database cache engine configured (reported by @ilnytskyi) has been fixed in #25722 by @andrewbess in 2.4-develop branch Related commits: 1. 5c121e2 2. 3905038 3. e59ee3a 4. 6633cc2
- Loading branch information
Showing
18 changed files
with
294 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogUrlRewrite\Setup\Patch\Data; | ||
|
||
use Magento\Catalog\Model\Product\Url; | ||
use Magento\Eav\Setup\EavSetup; | ||
use Magento\Eav\Setup\EavSetupFactory; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Magento\Framework\Setup\Patch\PatchVersionInterface; | ||
|
||
/** | ||
* Update url_key all products. | ||
*/ | ||
class UpdateUrlKeyForProducts implements DataPatchInterface, PatchVersionInterface | ||
{ | ||
/** | ||
* @var ModuleDataSetupInterface | ||
*/ | ||
private $moduleDataSetup; | ||
|
||
/** | ||
* @var EavSetup | ||
*/ | ||
private $eavSetup; | ||
|
||
/** | ||
* @var Url | ||
*/ | ||
private $urlProduct; | ||
|
||
/** | ||
* @param ModuleDataSetupInterface $moduleDataSetup | ||
* @param EavSetupFactory $eavSetupFactory | ||
* @param Url $urlProduct | ||
*/ | ||
public function __construct( | ||
ModuleDataSetupInterface $moduleDataSetup, | ||
EavSetupFactory $eavSetupFactory, | ||
Url $urlProduct | ||
) { | ||
$this->moduleDataSetup = $moduleDataSetup; | ||
$this->eavSetup = $eavSetupFactory->create(['setup' => $moduleDataSetup]); | ||
$this->urlProduct = $urlProduct; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
$productTypeId = $this->eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); | ||
$table = $this->moduleDataSetup->getTable('catalog_product_entity_varchar'); | ||
$select = $this->moduleDataSetup->getConnection()->select()->from( | ||
$table, | ||
['value_id', 'value'] | ||
)->where( | ||
'attribute_id = ?', | ||
$this->eavSetup->getAttributeId($productTypeId, 'url_key') | ||
); | ||
|
||
$result = $this->moduleDataSetup->getConnection()->fetchAll($select); | ||
foreach ($result as $key => $item) { | ||
$result[$key]['value'] = $this->urlProduct->formatUrlKey($item['value']); | ||
} | ||
|
||
foreach (array_chunk($result, 500, true) as $pathResult) { | ||
$this->moduleDataSetup->getConnection()->insertOnDuplicate($table, $pathResult, ['value']); | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function getVersion() | ||
{ | ||
return "2.4.0"; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.