Add a --and-confirmed parameter to the accounts:clear-unconfirmed command

Update the documentation
Bump the package number
This commit is contained in:
Timothée Jaussoin 2021-08-10 14:33:48 +02:00
parent b48c8f505d
commit dcbd01e5e3
3 changed files with 8 additions and 4 deletions

View file

@ -139,7 +139,7 @@ This will remove the nonces stored that were not updated after `x minutes`.
This request will remove the accounts that were not confirmed after `x days`. In the database an unconfirmed account is having the `activated` attribute set to `false`.
php artisan accounts:clear-unconfirmed {days} {--apply}
php artisan accounts:clear-unconfirmed {days} {--apply} {--and-confirmed}
The base request will not delete the related accounts by default. You need to add `--apply` to remove them.

View file

@ -26,7 +26,7 @@ use App\Account;
class RemoveUnconfirmedAccounts extends Command
{
protected $signature = 'accounts:clear-unconfirmed {days} {--apply}';
protected $signature = 'accounts:clear-unconfirmed {days} {--apply} {--and-confirmed}';
protected $description = 'Clear unconfirmed accounts after n days';
public function __construct()
@ -36,10 +36,14 @@ class RemoveUnconfirmedAccounts extends Command
public function handle()
{
$accounts = Account::where('activated', false)->where('creation_time', '<',
$accounts = Account::where('creation_time', '<',
Carbon::now()->subDays($this->argument('days'))->toDateTimeString()
);
if (!$this->option('and-confirmed')) {
$accounts = $accounts->where('activated', false);
}
if ($this->option('apply')) {
$this->info($accounts->count() . ' accounts deleted');
$accounts->delete();

View file

@ -8,7 +8,7 @@
#%define _datadir %{_datarootdir}
#%define _docdir %{_datadir}/doc
%define build_number 95
%define build_number 96
%define var_dir /var/opt/belledonne-communications
%define opt_dir /opt/belledonne-communications/share/flexisip-account-manager