From 496d29a79332360ebf149a2c0c82902e3a9c4396 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Thu, 3 Mar 2016 18:44:23 +0100 Subject: [PATCH] Move code to new method cleanBackups() --- src/Composer/Command/SelfUpdateCommand.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index d593bdae6..32dae3baa 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -192,14 +192,7 @@ TAGSPUBKEY // remove saved installations of composer if ($input->getOption('clean-backups')) { - $finder = $this->getOldInstallationFinder($rollbackDir); - - $fs = new Filesystem; - foreach ($finder as $file) { - $file = (string) $file; - $io->writeError('Removing: '.$file.''); - $fs->remove($file); - } + $this->cleanBackups($rollbackDir); } if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) { @@ -322,6 +315,19 @@ TAGSPUBKEY } } + protected function cleanBackups($rollbackDir) + { + $finder = $this->getOldInstallationFinder($rollbackDir); + $io = $this->getIO(); + $fs = new Filesystem; + + foreach ($finder as $file) { + $file = (string) $file; + $io->writeError('Removing: '.$file.''); + $fs->remove($file); + } + } + protected function getLastBackupVersion($rollbackDir) { $finder = $this->getOldInstallationFinder($rollbackDir);