From 546a49f231182bf401b04600c871b5c20504f7a8 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Fri, 3 Jun 2016 12:30:59 +0300 Subject: [PATCH 1/4] MAGETWO-53232: [Github] Customer Data is missing after upgrade from 2.0.2 to 2.0.4 #3951, #3964, #4054 --- .../Deploystrategy/DeploystrategyAbstract.php | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php index 53723ace..4e8aec5f 100644 --- a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php +++ b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php @@ -308,19 +308,12 @@ public function remove($source, $dest) // If source doesn't exist, check if it's a glob expression, otherwise we have nothing we can do if (!file_exists($sourcePath)) { - // Handle globing - $matches = glob($sourcePath); - if ($matches) { - foreach ($matches as $match) { - $newDest = substr($destPath . '/' . basename($match), strlen($this->getDestDir())); - $newDest = ltrim($newDest, ' \\/'); - $this->remove(substr($match, strlen($this->getSourceDir())+1), $newDest); - } - return; - } - - // Source file isn't a valid file or glob - throw new \ErrorException("Source $sourcePath does not exist"); + $this->handleGlobing($sourcePath, $destPath); + return; + } elseif (file_exists($sourcePath) && is_dir($sourcePath)) { + $this->handleGlobing($sourcePath . '/*', $destPath); + @rmdir($destPath); + return; } // MP Avoid removing whole folders in case the modman file is not 100% well-written @@ -331,6 +324,29 @@ public function remove($source, $dest) self::rmdirRecursive($destPath); } + /** + * Handle globing + * + * @param string $sourcePath + * @param string $destPath + * @throws \ErrorException + */ + protected function handleGlobing($sourcePath, $destPath) + { + $matches = glob($sourcePath); + if ($matches) { + foreach ($matches as $match) { + $newDest = substr($destPath . '/' . basename($match), strlen($this->getDestDir())); + $newDest = ltrim($newDest, ' \\/'); + $this->remove(substr($match, strlen($this->getSourceDir())+1), $newDest); + } + return; + } + + // Source file isn't a valid file or glob + throw new \ErrorException("Source $sourcePath does not exist"); + } + /** * Remove an empty directory branch up to $stopDir, or stop at the first non-empty parent. * From c09f59a8c2b3554cf14578179a3f1f8b6ec4edfa Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Mon, 6 Jun 2016 12:23:53 +0300 Subject: [PATCH 2/4] MAGETWO-53232: [Github] Customer Data is missing after upgrade from 2.0.2 to 2.0.4 #3951, #3964, #4054 --- .../Magento/Deploystrategy/DeploystrategyAbstract.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php index 4e8aec5f..05b49423 100644 --- a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php +++ b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php @@ -308,10 +308,10 @@ public function remove($source, $dest) // If source doesn't exist, check if it's a glob expression, otherwise we have nothing we can do if (!file_exists($sourcePath)) { - $this->handleGlobing($sourcePath, $destPath); + $this->removeContentOfCategory($sourcePath, $destPath); return; } elseif (file_exists($sourcePath) && is_dir($sourcePath)) { - $this->handleGlobing($sourcePath . '/*', $destPath); + $this->removeContentOfCategory($sourcePath . '/*', $destPath); @rmdir($destPath); return; } @@ -325,13 +325,13 @@ public function remove($source, $dest) } /** - * Handle globing + * Search and remove content of category * * @param string $sourcePath * @param string $destPath * @throws \ErrorException */ - protected function handleGlobing($sourcePath, $destPath) + protected function removeContentOfCategory($sourcePath, $destPath) { $matches = glob($sourcePath); if ($matches) { From 5012e39f6c69a985fb8217c33345f37689beb956 Mon Sep 17 00:00:00 2001 From: Bohdan Korablov Date: Tue, 7 Jun 2016 17:14:02 +0300 Subject: [PATCH 3/4] MAGETWO-53232: [Github] Customer Data is missing after upgrade from 2.0.2 to 2.0.4 #3951, #3964, #4054 --- .../Magento/Deploystrategy/DeploystrategyAbstract.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php index 05b49423..d7210ab0 100644 --- a/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php +++ b/src/MagentoHackathon/Composer/Magento/Deploystrategy/DeploystrategyAbstract.php @@ -333,9 +333,13 @@ public function remove($source, $dest) */ protected function removeContentOfCategory($sourcePath, $destPath) { - $matches = glob($sourcePath); + $sourcePath = preg_replace('#/\*$#', '/{,.}*', $sourcePath); + $matches = glob($sourcePath, GLOB_BRACE); if ($matches) { foreach ($matches as $match) { + if (preg_match("#/\.{1,2}$#", $match)) { + continue; + } $newDest = substr($destPath . '/' . basename($match), strlen($this->getDestDir())); $newDest = ltrim($newDest, ' \\/'); $this->remove(substr($match, strlen($this->getSourceDir())+1), $newDest); From 931a1795f6310704e5336885d3888c29a9a80a98 Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Thu, 9 Jun 2016 17:38:08 -0500 Subject: [PATCH 4/4] MAGETWO-54120: Installation fails because of colinmollenhour/cache-backend-redis in replace section Removing magento-hackathon/magento-composer-installer from replace section in root composer.json and adding to composer.json in magento/magento-composer-installer --- composer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composer.json b/composer.json index 8564f3f4..eff88349 100644 --- a/composer.json +++ b/composer.json @@ -50,6 +50,9 @@ "symfony/process":"*", "mikey179/vfsStream":"*" }, + "replace": { + "magento-hackathon/magento-composer-installer": "*" + }, "autoload":{ "psr-0":{ "MagentoHackathon\\Composer\\Magento":"src/"