Skip to content
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

Merged
merged 6 commits into from
Jun 14, 2018

Conversation

richardcanoe
Copy link
Contributor

Validate hook added to check access to pre-exisiting site folder and settings.php

'database-port' => InputOption::VALUE_REQUIRED,
'database-name' => InputOption::VALUE_REQUIRED,
'sites-subdir' => InputOption::VALUE_REQUIRED,
])
{
Copy link
Contributor

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?

ku-enza
ku-enza previously approved these changes Jun 12, 2018
Copy link
Contributor

@ku-enza ku-enza left a 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.
👍

Copy link
Contributor

@drupol drupol left a 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.


// Check that if site directory exists it is writable.
if (file_exists($siteDirectory)) {
if (!is_writable($siteDirectory)) {
Copy link
Contributor

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.

}
// Check that if site directory exists it is writable.
if (file_exists($siteDirectory.'/settings.php')) {
if (!is_writable($siteDirectory.'/settings.php')) {
Copy link
Contributor

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.

->databaseName($options['database-name'])
->sitesSubdir($options['sites-subdir'])
->siteProfile($options['site-profile']);
$task = $this->taskDrush($drush)
Copy link
Contributor

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.

Copy link
Contributor

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.

'root' => InputOption::VALUE_REQUIRED,
'config-dir' => InputOption::VALUE_REQUIRED,
'root' => InputOption::VALUE_REQUIRED,
'config-dir' => InputOption::VALUE_REQUIRED,
Copy link
Contributor

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.

@@ -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,
Copy link
Contributor

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.

voidtek
voidtek previously approved these changes Jun 14, 2018
Copy link
Member

@voidtek voidtek left a 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.

public function validateSiteInstall(CommandData $commandData)
{
$input = $commandData->input();
$siteDirectory = getcwd().'/'.$input->getOption('root').'/sites/'.$input->getOption('sites-subdir');
Copy link
Contributor

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')]);

$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.");
Copy link
Contributor

@drupol drupol Jun 14, 2018

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); 

$input = $commandData->input();
$siteDirectory = getcwd().'/'.$input->getOption('root').'/sites/'.$input->getOption('sites-subdir');

// Check that if files/folders required exist and they are writable.
Copy link
Contributor

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.

Copy link
Member

@voidtek voidtek left a 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.

Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@richardcanoe richardcanoe merged commit a4d7adf into master Jun 14, 2018
@richardcanoe richardcanoe deleted the OPENEUROPA-287 branch June 14, 2018 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants