Skip to content

Commit

Permalink
Merge pull request #79 from willemvb/master
Browse files Browse the repository at this point in the history
Improve console output
  • Loading branch information
freekmurze committed Mar 9, 2016
2 parents ef6e3fc + aa996a2 commit 0aaca21
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/BackupDestination/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ public function size()
public function delete()
{
$this->disk->delete($this->path);
consoleOutput()->info("Deleted backup {$this->path}");
consoleOutput()->info("Deleted backup {$this->path}.");
}
}
4 changes: 2 additions & 2 deletions src/Commands/BackupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class BackupCommand extends BaseCommand

public function handle()
{
consoleOutput()->comment('Starting backup.');
consoleOutput()->comment('Starting backup...');

try {
$this->guardAgainstInvalidOptions();
Expand All @@ -40,7 +40,7 @@ public function handle()

consoleOutput()->comment('Backup completed!');
} catch (Exception $exception) {
consoleOutput()->error("Backup failed because: {$exception->getMessage()}");
consoleOutput()->error("Backup failed because: {$exception->getMessage()}.");

event(new BackupHasFailed($exception));

Expand Down
2 changes: 1 addition & 1 deletion src/Commands/CleanupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CleanupCommand extends BaseCommand

public function handle()
{
consoleOutput()->comment('Starting cleanup.');
consoleOutput()->comment('Starting cleanup...');

try {
$config = config('laravel-backup');
Expand Down
8 changes: 3 additions & 5 deletions src/Tasks/Backup/BackupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function run()

$this->temporaryDirectory->delete();
} catch (Exception $exception) {
consoleOutput()->error("Backup failed because {$exception->getMessage()}");
consoleOutput()->error("Backup failed because {$exception->getMessage()}.");

event(new BackupHasFailed($exception));
}
Expand Down Expand Up @@ -149,8 +149,6 @@ protected function addDatabaseDumpsToZip(Zip $zip)
$temporaryFile = $this->temporaryDirectory->getPath($fileName);
$dbDumper->dumpToFile($temporaryFile);

consoleOutput()->info("Dumped database {$dbDumper->getDbName()}");

$zip->add($temporaryFile, $fileName);
});
}
Expand All @@ -175,11 +173,11 @@ protected function copyToBackupDestinations(Zip $zip)

$backupDestination->write($zip->getPath());

consoleOutput()->info("Successfully copied zip to {$backupDestination->getFilesystemType()}-filesystem");
consoleOutput()->info("Successfully copied .zip file to {$backupDestination->getFilesystemType()}-filesystem.");

event(new BackupWasSuccessful($backupDestination));
} catch (Exception $exception) {
consoleOutput()->error("Copying zip-file failed because: {$exception->getMessage()}");
consoleOutput()->error("Copying .zip file failed because: {$exception->getMessage()}.");

event(new BackupHasFailed($exception));
}
Expand Down
6 changes: 3 additions & 3 deletions src/Tasks/Cleanup/CleanupJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public function run()
throw new Exception("Could not connect to {$backupDestination->getFilesystemType()} because: {$backupDestination->getConnectionError()}");
};

consoleOutput()->info("Cleaning backups of {$backupDestination->getBackupName()} on {$backupDestination->getFilesystemType()}-filesystem");
consoleOutput()->info("Cleaning backups of {$backupDestination->getBackupName()} on {$backupDestination->getFilesystemType()}-filesystem...");

$this->strategy->deleteOldBackups($backupDestination->getBackups());
event(new CleanupWasSuccessFul($backupDestination));

$usedStorage = Format::getHumanReadableSize($backupDestination->getUsedStorage());
consoleOutput()->info("Used storage after cleanup: {$usedStorage}");
consoleOutput()->info("Used storage after cleanup: {$usedStorage}.");
} catch (Exception $exception) {
consoleOutput()->error("Cleanup failed because: {$exception->getMessage()}");
consoleOutput()->error("Cleanup failed because: {$exception->getMessage()}.");

event(new CleanupHasFailed($exception));
}
Expand Down

0 comments on commit 0aaca21

Please sign in to comment.