-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGECLOUD-1600: Merge ece-patches into ece-tools (#158)
- Loading branch information
1 parent
a9a9b91
commit 2644086
Showing
25 changed files
with
1,128 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"colinmollenhour/credis": { | ||
"Fix Redis issue": { | ||
"1.6": "patches/redis-pipeline.patch" | ||
} | ||
}, | ||
"magento/framework": { | ||
"Fix locker process": { | ||
"101.0.*": "patches/locker-process.patch" | ||
}, | ||
"Remove permissions check": { | ||
"101.0.*": "patches/remove-permission-checks.patch" | ||
}, | ||
"Fix redis session locking for 2.2.0 and 2.2.1": { | ||
"101.0.0||101.0.1": "patches/fix-redis-session-manager-locking.patch" | ||
} | ||
}, | ||
"magento/module-customer-import-export": { | ||
"Fix out of memory during import of customers and addresses": { | ||
">=100.2.0": "patches/fix-oom-during-import-customers-and-addresses.patch" | ||
} | ||
}, | ||
"magento/module-config": { | ||
"Fix app:config:import for Magento 2.2.2": { | ||
"=101.0.2": "patches/fix-app-config-import.patch" | ||
} | ||
} | ||
} |
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,14 @@ | ||
--- a/vendor/magento/module-config/Model/Config/Importer.php | ||
+++ b/vendor/magento/module-config/Model/Config/Importer.php | ||
@@ -129,8 +129,10 @@ class Importer implements ImporterInterface | ||
|
||
// Invoke saving of new values. | ||
$this->saveProcessor->process($changedData); | ||
- $this->flagManager->saveFlag(static::FLAG_CODE, $data); | ||
}); | ||
+ | ||
+ $this->scope->setCurrentScope($currentScope); | ||
+ $this->flagManager->saveFlag(static::FLAG_CODE, $data); | ||
} catch (\Exception $e) { | ||
throw new InvalidTransitionException(__('%1', $e->getMessage()), $e); | ||
} finally { |
110 changes: 110 additions & 0 deletions
110
patches/fix-oom-during-import-customers-and-addresses.patch
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,110 @@ | ||
commit 4ee8443a262e18c08b942aef313710b2c070a7a4 | ||
Author: Viktor Paladiichuk <[email protected]> | ||
Date: Thu Nov 16 18:55:15 2017 +0200 | ||
|
||
SET-36: Memory limit exhausted during import of customers and addresses | ||
|
||
diff --git a/vendor/magento/module-customer-import-export/Model/Import/Address.php b/vendor/magento/module-customer-import-export/Model/Import/Address.php | ||
index eb5742d24c7..70b8c34ef41 100644 | ||
--- a/vendor/magento/module-customer-import-export/Model/Import/Address.php | ||
+++ b/vendor/magento/module-customer-import-export/Model/Import/Address.php | ||
@@ -238,6 +238,11 @@ class Address extends AbstractCustomer | ||
protected $postcodeValidator; | ||
|
||
/** | ||
+ * @var array | ||
+ */ | ||
+ private $loadedAddresses; | ||
+ | ||
+ /** | ||
* @param \Magento\Framework\Stdlib\StringUtils $string | ||
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig | ||
* @param \Magento\ImportExport\Model\ImportFactory $importFactory | ||
@@ -368,21 +373,50 @@ class Address extends AbstractCustomer | ||
*/ | ||
protected function _initAddresses() | ||
{ | ||
- /** @var $address \Magento\Customer\Model\Address */ | ||
- foreach ($this->_addressCollection as $address) { | ||
- $customerId = $address->getParentId(); | ||
- if (!isset($this->_addresses[$customerId])) { | ||
- $this->_addresses[$customerId] = []; | ||
+ if ($this->_addressCollection->isLoaded()) { | ||
+ /** @var $address \Magento\Customer\Model\Address */ | ||
+ foreach ($this->_addressCollection as $address) { | ||
+ $customerId = $address->getParentId(); | ||
+ if (!isset($this->_addresses[$customerId])) { | ||
+ $this->_addresses[$customerId] = []; | ||
+ } | ||
+ $addressId = $address->getId(); | ||
+ if (!in_array($addressId, $this->_addresses[$customerId])) { | ||
+ $this->_addresses[$customerId][] = $addressId; | ||
+ } | ||
} | ||
- $addressId = $address->getId(); | ||
- if (!in_array($addressId, $this->_addresses[$customerId])) { | ||
- $this->_addresses[$customerId][] = $addressId; | ||
+ } else { | ||
+ foreach ($this->getLoadedAddresses() as $addressId => $address) { | ||
+ $customerId = $address['parent_id']; | ||
+ if (!isset($this->_addresses[$customerId])) { | ||
+ $this->_addresses[$customerId] = []; | ||
+ } | ||
+ if (!in_array($addressId, $this->_addresses[$customerId])) { | ||
+ $this->_addresses[$customerId][] = $addressId; | ||
+ } | ||
} | ||
} | ||
return $this; | ||
} | ||
|
||
/** | ||
+ * @return array | ||
+ */ | ||
+ private function getLoadedAddresses() | ||
+ { | ||
+ if (empty($this->loadedAddresses)) { | ||
+ $collection = clone $this->_addressCollection; | ||
+ $table = $collection->getMainTable(); | ||
+ $select = $collection->getSelect(); | ||
+ $select->reset('columns'); | ||
+ $select->reset('from'); | ||
+ $select->from($table, ['entity_id', 'parent_id']); | ||
+ $this->loadedAddresses = $collection->getResource()->getConnection()->fetchAssoc($select); | ||
+ } | ||
+ return $this->loadedAddresses; | ||
+ } | ||
+ | ||
+ /** | ||
* Initialize country regions hash for clever recognition | ||
* | ||
* @return $this | ||
diff --git a/vendor/magento/module-customer-import-export/Model/ResourceModel/Import/Customer/Storage.php b/vendor/magento/module-customer-import-export/Model/ResourceModel/Import/Customer/Storage.php | ||
index 4e6687bff28..359822df6d9 100644 | ||
--- a/vendor/magento/module-customer-import-export/Model/ResourceModel/Import/Customer/Storage.php | ||
+++ b/vendor/magento/module-customer-import-export/Model/ResourceModel/Import/Customer/Storage.php | ||
@@ -117,13 +117,18 @@ class Storage | ||
*/ | ||
public function getCustomerId($email, $websiteId) | ||
{ | ||
- // lazy loading | ||
- $this->load(); | ||
+ if (!isset($this->_customerIds[$email][$websiteId])) { | ||
+ $collection = clone $this->_customerCollection; | ||
+ $mainTable = $collection->getResource()->getEntityTable(); | ||
|
||
- if (isset($this->_customerIds[$email][$websiteId])) { | ||
- return $this->_customerIds[$email][$websiteId]; | ||
- } | ||
+ $select = $collection->getSelect(); | ||
+ $select->reset(); | ||
+ $select->from($mainTable, ['entity_id']); | ||
+ $select->where($mainTable . '.email = ?', $email); | ||
+ $select->where($mainTable . '.website_id = ?', $websiteId); | ||
|
||
- return false; | ||
+ $this->_customerIds[$email][$websiteId] = $collection->getResource()->getConnection()->fetchOne($select); | ||
+ } | ||
+ return $this->_customerIds[$email][$websiteId]; | ||
} | ||
} |
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,24 @@ | ||
diff --git a/vendor/magento/framework/Session/SessionManager.php b/vendor/magento/framework/Session/SessionManager.php | ||
index 2cea02f..272d3d9 100644 | ||
--- a/vendor/magento/framework/Session/SessionManager.php | ||
+++ b/vendor/magento/framework/Session/SessionManager.php | ||
@@ -504,18 +504,8 @@ class SessionManager implements SessionManagerInterface | ||
return $this; | ||
} | ||
|
||
- //@see http://php.net/manual/en/function.session-regenerate-id.php#53480 workaround | ||
if ($this->isSessionExists()) { | ||
- $oldSessionId = session_id(); | ||
- session_regenerate_id(); | ||
- $newSessionId = session_id(); | ||
- session_id($oldSessionId); | ||
- session_destroy(); | ||
- | ||
- $oldSession = $_SESSION; | ||
- session_id($newSessionId); | ||
- session_start(); | ||
- $_SESSION = $oldSession; | ||
+ session_regenerate_id(true); | ||
} else { | ||
session_start(); | ||
} |
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,76 @@ | ||
MDVA-2470 | ||
--- a/vendor/magento/framework/View/Asset/LockerProcess.php 2017-02-13 17:38:15.000000000 +0000 | ||
+++ b/vendor/magento/framework/View/Asset/LockerProcess.php 2017-02-13 18:53:22.000000000 +0000 | ||
@@ -68,12 +68,26 @@ | ||
|
||
$this->tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); | ||
$this->lockFilePath = $this->getFilePath($lockName); | ||
+ $this->waitForLock(); | ||
|
||
- while ($this->isProcessLocked()) { | ||
- usleep(1000); | ||
+ try { | ||
+ $this->tmpDirectory->writeFile($this->lockFilePath, time(), 'x+'); | ||
+ }catch (\Exception $e) { | ||
+ $this->waitForLock(); | ||
+ try { | ||
+ $this->tmpDirectory->writeFile($this->lockFilePath, time(), 'x+'); | ||
+ }catch (\Exception $e) { | ||
+ throw new \Exception($e->getMessage()); | ||
+ } | ||
} | ||
|
||
- $this->tmpDirectory->writeFile($this->lockFilePath, time()); | ||
+ } | ||
+ | ||
+ public function waitForLock() | ||
+ { | ||
+ while ($this->isProcessLocked() ) { | ||
+ usleep(500); | ||
+ } | ||
} | ||
|
||
/** | ||
--- a/vendor/magento/framework/View/Asset/PreProcessor/AlternativeSource.php 2017-02-14 20:49:33.000000000 +0000 | ||
+++ b/vendor/magento/framework/View/Asset/PreProcessor/AlternativeSource.php 2017-02-15 15:00:41.000000000 +0000 | ||
@@ -106,7 +106,7 @@ | ||
} | ||
|
||
try { | ||
- $this->lockerProcess->lockProcess($this->lockName); | ||
+ $this->lockerProcess->lockProcess($chain->getAsset()->getPath()); | ||
|
||
$module = $chain->getAsset()->getModule(); | ||
|
||
--- a/vendor/magento/framework/View/Asset/LockerProcess.php 2017-02-14 21:50:57.000000000 +0000 | ||
+++ b/vendor/magento/framework/View/Asset/LockerProcess.php 2017-02-15 15:00:41.000000000 +0000 | ||
@@ -67,7 +67,7 @@ | ||
} | ||
|
||
$this->tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); | ||
- $this->lockFilePath = $this->getFilePath($lockName); | ||
+ $this->lockFilePath = $this->getFilePath(str_replace(DIRECTORY_SEPARATOR, '_', $lockName)); | ||
$this->waitForLock(); | ||
|
||
try { | ||
@@ -77,7 +77,8 @@ | ||
try { | ||
$this->tmpDirectory->writeFile($this->lockFilePath, time(), 'x+'); | ||
}catch (\Exception $e) { | ||
- throw new \Exception($e->getMessage()); | ||
+ echo($this->lockFilePath); | ||
+ throw new \Exception("In exception for lock process" . $e->getMessage()); | ||
} | ||
} | ||
|
||
--- a/vendor/magento/module-developer/Model/View/Asset/PreProcessor/FrontendCompilation.php 2017-02-15 16:24:07.000000000 +0000 | ||
+++ b/vendor/magento/module-developer/Model/View/Asset/PreProcessor/FrontendCompilation.php 2017-02-15 16:24:07.000000000 +0000 | ||
@@ -76,7 +76,7 @@ | ||
{ | ||
|
||
try { | ||
- $this->lockerProcess->lockProcess($this->lockName); | ||
+ $this->lockerProcess->lockProcess($chain->getAsset()->getPath()); | ||
|
||
$path = $chain->getAsset()->getFilePath(); | ||
$module = $chain->getAsset()->getModule(); |
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,12 @@ | ||
diff --git a/vendor/colinmollenhour/credis/Client.php b/vendor/colinmollenhour/credis/Client.php | ||
index afbc85d..8368b32 100755 | ||
--- a/vendor/colinmollenhour/credis/Client.php | ||
+++ b/vendor/colinmollenhour/credis/Client.php | ||
@@ -1017,6 +1017,7 @@ class Credis_Client { | ||
} else { | ||
$this->isMulti = TRUE; | ||
$this->redisMulti = call_user_func_array(array($this->redis, $name), $args); | ||
+ return $this; | ||
} | ||
} | ||
else if($name == 'exec' || $name == 'discard') { |
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,43 @@ | ||
diff -Naur b/vendor/magento/framework/Setup/FilePermissions.php a/vendor/magento/framework/Setup/FilePermissions.php | ||
--- b/vendor/magento/framework/Setup/FilePermissions.php 2016-09-23 16:01:12.000000000 -0500 | ||
+++ a/vendor/magento/framework/Setup/FilePermissions.php 2016-09-23 16:22:09.000000000 -0500 | ||
@@ -233,26 +233,8 @@ | ||
*/ | ||
public function getMissingWritablePathsForInstallation($associative = false) | ||
{ | ||
- $required = $this->getInstallationWritableDirectories(); | ||
- $current = $this->getInstallationCurrentWritableDirectories(); | ||
- $missingPaths = []; | ||
- foreach (array_diff($required, $current) as $missingPath) { | ||
- if (isset($this->nonWritablePathsInDirectories[$missingPath])) { | ||
- if ($associative) { | ||
- $missingPaths[$missingPath] = $this->nonWritablePathsInDirectories[$missingPath]; | ||
- } else { | ||
- $missingPaths = array_merge( | ||
- $missingPaths, | ||
- $this->nonWritablePathsInDirectories[$missingPath] | ||
- ); | ||
- } | ||
- } | ||
- } | ||
- if ($associative) { | ||
- $required = array_flip($required); | ||
- $missingPaths = array_merge($required, $missingPaths); | ||
- } | ||
- return $missingPaths; | ||
+ // Unnecessary check in controlled environment | ||
+ return []; | ||
} | ||
|
||
/** | ||
@@ -275,8 +257,7 @@ | ||
*/ | ||
public function getUnnecessaryWritableDirectoriesForApplication() | ||
{ | ||
- $required = $this->getApplicationNonWritableDirectories(); | ||
- $current = $this->getApplicationCurrentNonWritableDirectories(); | ||
- return array_diff($required, $current); | ||
+ // Unnecessary check in controlled environment | ||
+ return []; | ||
} | ||
} |
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
Oops, something went wrong.