Skip to content

Commit

Permalink
added live import option
Browse files Browse the repository at this point in the history
  • Loading branch information
pseux committed Aug 4, 2018
1 parent ecf4c40 commit d360ae3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ AWS_BUCKET=
Add the following code to the `schedule` function in your `App\Console\Kernel.php` file:

$schedule->command('backup:run')->daily();

## Loading backups

php artisan backup:run --import
6 changes: 4 additions & 2 deletions src/Commands/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Backup extends Command
*
* @var string
*/
protected $signature = 'backup:run {--import}';
protected $signature = 'backup:run {--import} {--live}';

/**
* The console command description.
Expand Down Expand Up @@ -78,6 +78,7 @@ private function runBackup()

// -- Upload backup
Storage::disk('s3')->putFileAs($remote_dir, new File($dir . '/' . $filename), $filename);
Storage::disk('s3')->delete($remote_dir . '/current.sql.gz');
Storage::disk('s3')->copy($remote_dir . '/' . $filename, $remote_dir . '/current.sql.gz');
}
catch (\Exception $e)
Expand All @@ -91,7 +92,8 @@ private function runBackup()

private function runImport()
{
$remote_dir = config('app.env') . '-' . config('app.name');
$remote_dir = $this->option('live') ? 'live' : config('app.env');
$remote_dir .= '-' . config('app.name');
$remote_dir = str_slug($remote_dir);

try
Expand Down

0 comments on commit d360ae3

Please sign in to comment.