Skip to content

Commit

Permalink
feat: update owner config json command to enable change in both the u…
Browse files Browse the repository at this point in the history
…ser and the group
  • Loading branch information
tanhongit committed Nov 24, 2023
1 parent e4d384a commit c413f9e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Commands/ChangeOwnerConfigJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ class ChangeOwnerConfigJson extends Command
*
* @var string
*/
protected $signature = 'config-json:change-owner {--user= : user}';
protected $signature = 'config-json:change-owner
{user : The user to change owner}
{group? : The group to change owner}';

/**
* The console command description.
Expand All @@ -27,10 +29,12 @@ class ChangeOwnerConfigJson extends Command
*/
public function handle(): void
{
$user = $this->option('user');
$user = $this->argument('user');
$group = $this->argument('group') ?? $user;

$jsonsPath = config('telegram-git-notifier.data_file.storage_folder');
if (is_string($jsonsPath) && file_exists($jsonsPath)) {
exec("chown -R $user:$user $jsonsPath");
exec("chown -R $user:$group $jsonsPath");
}
}
}

0 comments on commit c413f9e

Please sign in to comment.