Skip to content

Commit

Permalink
prepare 2.10.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Feb 25, 2016
1 parent 1dc8c61 commit f62f211
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All Notable changes to `laravel-backup` will be documented in this file

###2.10.0
- Add `list`-command
- Make the `dump_command_path`-option a bit more robust

###2.9.2
- Fix installation error when using Symfony 3

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ php artisan backup:clean
```
The clean up will happen on all configured filesystems.

### List all backups

You can view a list of all backups by running the list command:
``` bash
php artisan backup:list
```

## Testing

Run the tests with:
Expand Down
4 changes: 2 additions & 2 deletions src/BackupHandlers/Database/Databases/PgSQLDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PgSQLDatabase implements DatabaseInterface
* @param string $username
* @param $password
* @param string string $host
* @param int $port
* @param int $port
*/
public function __construct(Console $console, $database, $schema, $username, $password, $host, $port)
{
Expand All @@ -43,7 +43,7 @@ public function __construct(Console $console, $database, $schema, $username, $pa
*/
public function dump($destinationFile)
{
$command = sprintf('export PGHOST && %spg_dump ' . (!$this->useCopy() ? '--inserts' : '') . ' --schema=%s %s > %s',
$command = sprintf('export PGHOST && %spg_dump '.(!$this->useCopy() ? '--inserts' : '').' --schema=%s %s > %s',
$this->getDumpCommandPath(),
escapeshellarg($this->schema),
escapeshellarg($this->database),
Expand Down
12 changes: 8 additions & 4 deletions src/Commands/ListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Carbon\Carbon;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;

class ListCommand extends Command
Expand All @@ -26,7 +25,8 @@ class ListCommand extends Command
public function fire()
{
$path = config('laravel-backup.destination.path');
$collection = new Collection();

$collection = collect();

foreach ($this->getTargetFileSystems() as $filesystem) {
$disk = Storage::disk($filesystem);
Expand All @@ -49,12 +49,12 @@ public function fire()
$lastModified = Carbon::createFromTimestamp($value['lastModified']);

$value['lastModified'] = $lastModified;
$value['age'] = $lastModified->diffForHumans();
$value['age'] = $this->getAgeInDays($lastModified);

return $value;
});

$this->table(['Filesystem', 'Filename', 'Created at', 'Age'], $rows);
$this->table(['Filesystem', 'Filename', 'Created at', 'Age in days'], $rows);
}

/**
Expand All @@ -73,4 +73,8 @@ protected function getTargetFileSystems()
return [$fileSystems];
}

protected function getAgeInDays(Carbon $date)
{
return number_format(round($date->diffInMinutes() / (24 * 60), 2), 2).' ('.$date->diffForHumans().')';
}
}
6 changes: 3 additions & 3 deletions tests/DatabaseBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ class DatabaseBuilderTest extends PHPUnit_Framework_TestCase
public function testMySQL()
{
$config = [
'driver' => 'mysql',
'host' => 'localhost',
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'database',
'username' => 'root',
'password' => '',
'port' => '3307',
'port' => '3307',
];

$socket = '/var/run/mysqld/mysqld.sock';
Expand Down
4 changes: 2 additions & 2 deletions tests/PgSQLDatabaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testDump()
'PGHOST' => 'localhost',
'PGUSER' => 'testUser',
'PGPASSWORD' => 'password',
'PGPORT' => '5432'
'PGPORT' => '5432',
])
->once()
->andReturn(true);
Expand All @@ -57,4 +57,4 @@ public function testDump()
$this->database->dump('testfile.sql')
);
}
}
}

0 comments on commit f62f211

Please sign in to comment.