forked from magento/ece-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize Magento Cloud configuration package
- Loading branch information
0 parents
commit cad3bc6
Showing
16 changed files
with
4,055 additions
and
0 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,7 @@ | ||
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license | ||
|
||
http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
Please see LICENSE.txt for the full text of the OSL 3.0 license or contact [email protected] for a copy. | ||
|
||
Subject to Licensee's payment of fees and compliance with the terms and conditions of the MEE License, the MEE License supersedes the OSL 3.0 license for each source file. | ||
Please see <insert file name of the MEE license> for the full text of the MEE License or visit http://magento.com/legal/terms/enterprise. |
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,3 @@ | ||
# Magento 2 configuration | ||
|
||
Provides default configuration to build and deploy Magento 2 Enterprise Edition. |
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,8 @@ | ||
<?php | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
if (PHP_SAPI == 'cli') { | ||
\Magento\Framework\Console\CommandLocator::register('Magento\MagentoCloud\Console\CommandList'); | ||
} |
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,20 @@ | ||
{ | ||
"name": "magento/magento-cloud-configuration", | ||
"description": "Provides default configuration to build and deploy Magento 2 Enterprise Edition", | ||
"version": "1.0.3", | ||
"license": [ | ||
"OSL-3.0", | ||
"AFL-3.0" | ||
], | ||
"require": { | ||
"php": ">=5.6.0" | ||
}, | ||
"autoload": { | ||
"files": [ | ||
"cli_commands.php" | ||
], | ||
"psr-4": { | ||
"Magento\\MagentoCloud\\": ["src/Magento/MagentoCloud"] | ||
} | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
$root = __DIR__ . '/../../../'; | ||
copy($root . 'app/etc/NonComposerComponentRegistration.php', $root . 'app/NonComposerComponentRegistration.php'); | ||
copy($root . 'app/etc/di.xml', $root . 'app/di.xml'); | ||
|
||
$dirName = __DIR__ . '/patches'; | ||
$dir = new DirectoryIterator($dirName); | ||
foreach ($dir as $fileinfo) { | ||
if (!$fileinfo->isDot()) { | ||
$cmd = 'git apply ' . $dirName . '/' . $fileinfo->getFilename(); | ||
$output = ''; | ||
$status = ''; | ||
exec($cmd, $output, $status); | ||
} | ||
} | ||
|
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,130 @@ | ||
diff --git a/setup/src/Magento/Setup/Model/FilePermissions.php b/setup/src/Magento/Setup/Model/FilePermissions.php | ||
index 43dc400..9b06dc7 100644 | ||
--- a/setup/src/Magento/Setup/Model/FilePermissions.php | ||
+++ b/setup/src/Magento/Setup/Model/FilePermissions.php | ||
@@ -30,6 +30,13 @@ class FilePermissions | ||
protected $installationWritableDirectories = []; | ||
|
||
/** | ||
+ * List of required writable directories for upgrade | ||
+ * | ||
+ * @var array | ||
+ */ | ||
+ protected $upgradeWritableDirectories = []; | ||
+ | ||
+ /** | ||
* List of recommended non-writable directories for application | ||
* | ||
* @var array | ||
@@ -44,6 +51,13 @@ class FilePermissions | ||
protected $installationCurrentWritableDirectories = []; | ||
|
||
/** | ||
+ * List of current writable directories for upgrade | ||
+ * | ||
+ * @var array | ||
+ */ | ||
+ protected $upgradeCurrentWritableDirectories = []; | ||
+ | ||
+ /** | ||
* List of current non-writable directories for application | ||
* | ||
* @var array | ||
@@ -84,6 +98,25 @@ class FilePermissions | ||
} | ||
|
||
/** | ||
+ * Retrieve list of required writable directories for installation | ||
+ * | ||
+ * @return array | ||
+ */ | ||
+ public function getUpgradeWritableDirectories() | ||
+ { | ||
+ if (!$this->upgradeWritableDirectories) { | ||
+ $data = [ | ||
+ DirectoryList::CONFIG, | ||
+ DirectoryList::VAR_DIR, | ||
+ ]; | ||
+ foreach ($data as $code) { | ||
+ $this->upgradeWritableDirectories[$code] = $this->directoryList->getPath($code); | ||
+ } | ||
+ } | ||
+ return array_values($this->upgradeWritableDirectories); | ||
+ } | ||
+ | ||
+ /** | ||
* Retrieve list of recommended non-writable directories for application | ||
* | ||
* @return array | ||
@@ -119,6 +152,23 @@ class FilePermissions | ||
} | ||
|
||
/** | ||
+ * Retrieve list of currently writable directories for installation | ||
+ * | ||
+ * @return array | ||
+ */ | ||
+ public function getUpgradeCurrentWritableDirectories() | ||
+ { | ||
+ if (!$this->upgradeCurrentWritableDirectories) { | ||
+ foreach ($this->upgradeWritableDirectories as $code => $path) { | ||
+ if ($this->isWritable($code) && $this->checkRecursiveDirectories($path)) { | ||
+ $this->upgradeCurrentWritableDirectories[] = $path; | ||
+ } | ||
+ } | ||
+ } | ||
+ return $this->upgradeCurrentWritableDirectories; | ||
+ } | ||
+ | ||
+ /** | ||
* Check all sub-directories and files except for var/generation and var/di | ||
* | ||
* @param string $directory | ||
@@ -217,6 +267,18 @@ class FilePermissions | ||
} | ||
|
||
/** | ||
+ * Checks writable directories for upgrade | ||
+ * | ||
+ * @return array | ||
+ */ | ||
+ public function getMissingWritableDirectoriesForUpgrade() | ||
+ { | ||
+ $required = $this->getUpgradeWritableDirectories(); | ||
+ $current = $this->getUpgradeCurrentWritableDirectories(); | ||
+ return array_diff($required, $current); | ||
+ } | ||
+ | ||
+ /** | ||
* Checks non-writable directories for application | ||
* | ||
* @return array | ||
diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php | ||
index a5da578..3bbc3ac 100644 | ||
--- a/setup/src/Magento/Setup/Model/Installer.php | ||
+++ b/setup/src/Magento/Setup/Model/Installer.php | ||
@@ -439,6 +439,15 @@ class Installer | ||
} | ||
} | ||
|
||
+ public function checkUpgradeFilePermissions() | ||
+ { | ||
+ $results = $this->filePermissions->getMissingWritableDirectoriesForUpgrade(); | ||
+ if ($results) { | ||
+ $errorMsg = "Missing write permissions to the following directories: '" . implode("' '", $results) . "'"; | ||
+ throw new \Exception($errorMsg); | ||
+ } | ||
+ } | ||
+ | ||
/** | ||
* Check permissions of directories that are expected to be non-writable for application | ||
* | ||
@@ -741,7 +750,7 @@ class Installer | ||
public function installDataFixtures() | ||
{ | ||
$setup = $this->dataSetupFactory->create(); | ||
- $this->checkInstallationFilePermissions(); | ||
+ $this->checkUpgradeFilePermissions(); | ||
$this->log->log('Data install/update:'); | ||
$this->handleDBSchemaData($setup, 'data'); | ||
} |
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 --git a/app/autoload.php b/app/autoload.php | ||
index 4d991dd..1d1873d 100644 | ||
--- a/app/autoload.php | ||
+++ b/app/autoload.php | ||
@@ -13,7 +13,7 @@ use Magento\Framework\Autoload\ClassLoaderWrapper; | ||
*/ | ||
define('BP', dirname(__DIR__)); | ||
|
||
-$vendorDir = require BP . '/app/etc/vendor_path.php'; | ||
+$vendorDir = './vendor'; | ||
$vendorAutoload = BP . "/{$vendorDir}/autoload.php"; | ||
|
||
/* 'composer install' validation */ | ||
|
||
diff --git a/vendor/magento/framework/App/Arguments/FileResolver/Primary.php b/vendor/magento/framework/App/Arguments/FileResolver/Primary.php | ||
index 40b74e9..0f732c9 100644 | ||
--- a/vendor/magento/framework/App/Arguments/FileResolver/Primary.php | ||
+++ b/vendor/magento/framework/App/Arguments/FileResolver/Primary.php | ||
@@ -29,7 +29,7 @@ class Primary implements \Magento\Framework\Config\FileResolverInterface | ||
\Magento\Framework\Filesystem $filesystem, | ||
\Magento\Framework\Config\FileIteratorFactory $iteratorFactory | ||
) { | ||
- $this->configDirectory = $filesystem->getDirectoryRead(DirectoryList::CONFIG); | ||
+ $this->configDirectory = $filesystem->getDirectoryRead(DirectoryList::APP); | ||
$this->iteratorFactory = $iteratorFactory; | ||
} | ||
|
||
ff --git a/vendor/magento/framework/Composer/ComposerJsonFinder.php b/vendor/magento/framework/Composer/ComposerJsonFinder.php | ||
index bb17b2b..a48c5fc 100644 | ||
--- a/vendor/magento/framework/Composer/ComposerJsonFinder.php | ||
+++ b/vendor/magento/framework/Composer/ComposerJsonFinder.php | ||
@@ -36,10 +36,7 @@ class ComposerJsonFinder | ||
public function findComposerJson() | ||
{ | ||
// composer.json is in same directory as vendor | ||
- $vendorPath = $this->directoryList->getPath(DirectoryList::CONFIG) . '/vendor_path.php'; | ||
- $vendorDir = require "{$vendorPath}"; | ||
- | ||
- $composerJson = $this->directoryList->getPath(DirectoryList::ROOT) . "/{$vendorDir}/../composer.json"; | ||
+ $composerJson = $this->directoryList->getPath(DirectoryList::ROOT) . "/vendor/../composer.json"; | ||
|
||
$composerJson = realpath($composerJson); | ||
|
Oops, something went wrong.