-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add option to keep Files in Rollback #11750
Add option to keep Files in Rollback #11750
Conversation
foreach ($file as $statement) { | ||
$this->getResourceModel()->runCommand($statement); | ||
} | ||
@unlink($source); | ||
if ($this->keepSourceFile()) { |
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 logic seems to be reversed here and should be !$this->keepSourceFile()
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 will check tomorrow, maybe I was wrong copying between branches
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.
Thanks!
* | ||
* @var boolean | ||
*/ | ||
protected $keepSourceFile; |
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.
Let's make this private.
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.
Made Private
* @param boolean $keepSourceFile | ||
* @return $this | ||
*/ | ||
public function setKeepSourceFile($keepSourceFile) |
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.
Let's add a new interface for these methods.
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.
Added to SourceFileInterface
* | ||
* @return boolean | ||
*/ | ||
public function keepSourceFile(); |
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.
Let's move these to a new interface.
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.
Added to SourceFileInterface
@@ -127,7 +127,13 @@ protected function execute(InputInterface $input, OutputInterface $output) | |||
if (!$helper->ask($input, $output, $question) && $input->isInteractive()) { | |||
return \Magento\Framework\Console\Cli::RETURN_FAILURE; | |||
} | |||
$this->doRollback($input, $output); | |||
$questionKeep = new ConfirmationQuestion( | |||
'<info>you want to keep the backups?[y/N]<info>', |
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.
How about "Do you want to keep the backup files?" as the message here.
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.
Fixed typo
…of Backup Library
6f5b992
to
fd034dc
Compare
@dmanners Added changes, I hope everything are Ok ;-) |
Add option to keep files in rollback and improve Readability and PSR of Backup Library
Description
Ask to user when launch command:
bin/magento setup:rollback
if he wants keep files to future rollbacks. Also I changed variable name protected with underscore to acomplish PSR and I imported all classes to use in class.Fixed Issues (if relevant)
Manual testing scenarios
bin/magento setup:backup --media
bin/magento setup:rollback -m 1508950479_filesystem_media.tgz
y
to question:you want to keep the backups?[y/N]
var/backups
Contribution checklist