-
Notifications
You must be signed in to change notification settings - Fork 82
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
MAGECLOUD-343: Method for exporting a DB Backup of production site #94
MAGECLOUD-343: Method for exporting a DB Backup of production site #94
Conversation
…-343 # Conflicts: # src/App/Container.php # src/Application.php # src/Test/Unit/ApplicationTest.php
src/Process/DbDump/DbDump.php
Outdated
} | ||
fclose($lockFileHandle); | ||
} catch (\Exception $e) { | ||
$this->logger->info('ERROR: ' . $e->getMessage()); |
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.
Here you can use ->error
method instead of ->info
to avoid adding 'ERROR: '
to log message
src/Process/DbDump/DbDump.php
Outdated
$errors = $this->shell->execute('bash -c "set -o pipefail; ' . $command . '"'); | ||
|
||
if ($errors) { | ||
$this->logger->info('Error has occurred during mysqldump'); |
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.
Here you can increase log level to error
to emphasize message value
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.
the same on line 90
|
||
$this->process->execute(); | ||
|
||
// As we do not know the dump file name before running script, |
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.
You can use \phpmock\phpunit\PHPMock class for mocking php functions. Please look into StaticContentCleanerTest
class.
@NadiyaS please add link to task MAGECLOUD-343 |
QA approved |
…-343 # Conflicts: # src/App/Container.php
src/Process/DbDump/DbDump.php
Outdated
*/ | ||
private function getCommand() | ||
{ | ||
$command = "timeout 3600 mysqldump -h {$this->connectionData->getHost()} -P {$this->connectionData->getPort()}" |
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.
Value 3600 should be at least cons
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.
Ok, I'll move this value to constant
* | ||
* @return string | ||
*/ | ||
public function getHost(); |
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.
Add PHP strict types (:int
, :string
, etc to all methods you introduced)
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.
we cannot add strict types to all methods as some of them can return several types. Also, we need to review class Environment which returns values of environment variables, because now almost all methods return string type even if the variable does not exist. And these changes may affect current Interface as it uses Environment class
Will be re-worked a bit. After discussion agreed to add / remove some items. |
MAGECLOUD-343 Method for exporting a DB Backup of production site
Description
New CLI command to create DB dump on CLOUD
Zephyr Tests
Contribution checklist