-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OPENEUROPA-287: Add sanity check before starting site install. #53
Conversation
src/Commands/DrupalCommands.php
Outdated
'database-port' => InputOption::VALUE_REQUIRED, | ||
'database-name' => InputOption::VALUE_REQUIRED, | ||
'sites-subdir' => InputOption::VALUE_REQUIRED, | ||
]) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we have these indentations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed... it's working.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rebase the 3 commits regarding spaces. There is no need to have 3 commits that do the same thing.
src/Commands/DrupalCommands.php
Outdated
|
||
// Check that if site directory exists it is writable. | ||
if (file_exists($siteDirectory)) { | ||
if (!is_writable($siteDirectory)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd merge this condition into the previous one.
src/Commands/DrupalCommands.php
Outdated
} | ||
// Check that if site directory exists it is writable. | ||
if (file_exists($siteDirectory.'/settings.php')) { | ||
if (!is_writable($siteDirectory.'/settings.php')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd merge this condition into the previous one.
src/Commands/DrupalCommands.php
Outdated
->databaseName($options['database-name']) | ||
->sitesSubdir($options['sites-subdir']) | ||
->siteProfile($options['site-profile']); | ||
$task = $this->taskDrush($drush) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this coming from, I'm starting to see this since a couple of days and I don't know what to think about it yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove it as these are considered as unrelated changes in this PR.
src/Commands/DrupalCommands.php
Outdated
'root' => InputOption::VALUE_REQUIRED, | ||
'config-dir' => InputOption::VALUE_REQUIRED, | ||
'root' => InputOption::VALUE_REQUIRED, | ||
'config-dir' => InputOption::VALUE_REQUIRED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove it as these are considered as unrelated changes in this PR.
src/Commands/DrupalCommands.php
Outdated
@@ -237,7 +263,7 @@ public function drushSetup(array $options = [ | |||
* @return \Robo\Collection\CollectionBuilder | |||
*/ | |||
public function settingsSetup(array $options = [ | |||
'root' => InputOption::VALUE_REQUIRED, | |||
'root' => InputOption::VALUE_REQUIRED, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove it as these are considered as unrelated changes in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on oe_webtools project.
src/Commands/DrupalCommands.php
Outdated
public function validateSiteInstall(CommandData $commandData) | ||
{ | ||
$input = $commandData->input(); | ||
$siteDirectory = getcwd().'/'.$input->getOption('root').'/sites/'.$input->getOption('sites-subdir'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$siteDirectory = implode('/', [getcwd(), $input->getOption('root'), 'sites', $input->getOption('sites-subdir')]);
src/Commands/DrupalCommands.php
Outdated
$requiredFiles = [$siteDirectory, $siteDirectory.'/settings.php']; | ||
foreach ($requiredFiles as $requiredFile) { | ||
if (file_exists($requiredFile) && !is_writable($requiredFile)) { | ||
throw new \Exception("The file/folder '$requiredFile' must be writable for installation to continue."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sprintf('The file or the folder '%s' does not exist or is not writable.', $requiredFile);
src/Commands/DrupalCommands.php
Outdated
$input = $commandData->input(); | ||
$siteDirectory = getcwd().'/'.$input->getOption('root').'/sites/'.$input->getOption('sites-subdir'); | ||
|
||
// Check that if files/folders required exist and they are writable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Check if required files/folders exist and they are writable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tested on oe_webtools.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Validate hook added to check access to pre-exisiting site folder and settings.php