Skip to content

Conversation

marcelovani
Copy link
Contributor

Added support for s3.
It will check if it's an s3 dump, then copy it locally.

@guardiola86 guardiola86 merged commit 61445b2 into master May 15, 2017
'version' => 'latest',
];
$client = new S3Client($options);
$client->registerStreamWrapper();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is the actual need for the stream wrapper?

}
else {
// Open a stream in read-only mode
if ($stream = fopen($filename, 'r')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't see a case where the code would fall into this routine, also, this seems to be doing the same as in https://github.com/dennisinteractive/drupal_console_commands/blob/master/src/Command/SiteDbImportCommand.php#L197

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be a good idea to move the bit of logic to deal with copying the dump in execute() into download() and let it deal with the source (local, s3, etc)

}
}
else {
throw new SiteCommandException("The DB dump could not be saved to the local destination.");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to make sure that this won't stop the site being installed from the scratch if the dump is not found

}

// If the db dump is not local, download it locally.
if (!stream_is_local($this->filename)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we need some extra check for the existence of the file (in case of nfs mount) and use the stream wrapper to check the file size to avoid copying it again if it the size did not change since last execution

@marcelovani marcelovani deleted the 27611_s3 branch July 6, 2017 22:41
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.

3 participants