Skip to content

Commit

Permalink
Merge pull request #3 from provtv/dev
Browse files Browse the repository at this point in the history
up
  • Loading branch information
marco76tv authored Nov 19, 2024
2 parents ea01ea6 + d545068 commit 9e2abe7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
22 changes: 9 additions & 13 deletions Actions/DB/DownloadAction.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

/**
* ---.
*/

declare(strict_types=1);

namespace Modules\Setting\Actions\DB;
Expand All @@ -16,29 +18,23 @@ class DownloadAction
{
use QueueableAction;

/**
/**
* Execute the action.
*/


public function execute(string $connectionName): BinaryFileResponse
{
/**
* @var array
*/
$db = config('database.connections.'.$connectionName);
$filename = 'backup-'.$connectionName.'-'.Carbon::now()->format('Y-m-d').'.gz';
$backup_path = Storage::disk('cache')->path('backup/'.$filename);
$db = config('database.connections.' . $connectionName);
$filename = 'backup-' . $connectionName . '-' . Carbon::now()->format('Y-m-d') . '.gz';
$backup_path = Storage::disk('cache')->path('backup/' . $filename);
$backup_path = app(\Modules\Xot\Actions\File\FixPathAction::class)->execute($backup_path);
app(\Modules\Xot\Actions\File\CreateDirectoryForFilenameAction::class)->execute($backup_path);

$command = sprintf(
'mysqldump --user=%s --password=%s %s | gzip > %s',
$db['username'],
$db['password'],
$db['database'],
$backup_path,
);
$command = sprintf('mysqldump --user=%s --password=%s %s | gzip > %s', $db['username'], $db['password'], $db['database'], $backup_path,);
LaravelProcess::run($command);

return response()->download($backup_path);
}
}
4 changes: 2 additions & 2 deletions Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Provides event handling configuration for the Setting module.
*
Expand All @@ -21,8 +22,7 @@ class EventServiceProvider extends BaseEventServiceProvider
* @var array<string, array<int, string>>
*/
protected $listen = [];

/**
/**
* Indicates if events should be discovered.
*
* @var bool
Expand Down
6 changes: 3 additions & 3 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->paths(
[
__DIR__.'',
__DIR__ . '',
]
);

$rectorConfig->skip(
[
__DIR__.'/vendor',
__DIR__.'/docs',
__DIR__ . '/vendor',
__DIR__ . '/docs',
]
);

Expand Down

0 comments on commit 9e2abe7

Please sign in to comment.