-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from jadu/feature/limit-backups
MET-89: Add an optional parameter limit-backups on patching stage
- Loading branch information
Showing
12 changed files
with
305 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Meteor\Patch\Backup; | ||
|
||
trait BackupHandlerTrait | ||
{ | ||
|
||
public function removeBackups($backups, $count) | ||
{ | ||
// Do not remove the latest backups that can be kept | ||
$backups = array_slice($backups, $count); | ||
|
||
$this->io->text(sprintf('It is recommended to keep a maximum of %d backups. To free up some disk space the following %d backups should be removed: ', $count, count($backups))); | ||
|
||
// Get just the backup directory names | ||
$backupDirs = array_map(function ($backup) { | ||
return $backup->getPath(); | ||
}, $backups); | ||
|
||
$this->io->listing($backupDirs); | ||
|
||
$confirmation = $this->io->askConfirmation('Would you like to remove these backups?', true); | ||
if (!$confirmation) { | ||
return; | ||
} | ||
|
||
foreach ($backups as $backup) { | ||
$this->io->text(sprintf('Removing backup <info>%s</info>', $backup->getDate()->format('c'))); | ||
$this->filesystem->remove($backup->getPath()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.