2024-03-20 17:48:13 +01:00
|
|
|
<?php
|
2024-03-20 17:55:25 +01:00
|
|
|
|
2025-01-03 08:15:09 +01:00
|
|
|
|
2024-03-20 17:48:13 +01:00
|
|
|
/*
|
2025-01-03 08:15:09 +01:00
|
|
|
* CallsLaravelPassportKeys.php
|
|
|
|
* Copyright (c) 2025 james@firefly-iii.org.
|
2024-03-20 17:48:13 +01:00
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see https://www.gnu.org/licenses/.
|
|
|
|
*/
|
|
|
|
|
2025-01-03 08:15:09 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2024-03-20 17:48:13 +01:00
|
|
|
namespace FireflyIII\Console\Commands\System;
|
|
|
|
|
|
|
|
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
use Symfony\Component\Console\Command\Command as CommandAlias;
|
|
|
|
|
2024-12-27 09:30:41 +01:00
|
|
|
class CallsLaravelPassportKeys extends Command
|
2024-03-20 17:48:13 +01:00
|
|
|
{
|
|
|
|
use ShowsFriendlyMessages;
|
|
|
|
|
|
|
|
protected $description = 'Calls the Laravel "passport:keys" but doesn\'t exit 1.';
|
2024-04-02 15:40:33 +02:00
|
|
|
protected $signature = 'firefly-iii:laravel-passport-keys';
|
2024-03-20 17:48:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
2024-04-02 15:40:33 +02:00
|
|
|
public function handle(): int
|
2024-03-20 17:48:13 +01:00
|
|
|
{
|
|
|
|
Artisan::call('passport:keys --no-interaction', []);
|
|
|
|
$result = Artisan::output();
|
|
|
|
if (str_contains($result, 'Encryption keys already exist')) {
|
|
|
|
$this->friendlyInfo('Encryption keys exist already.');
|
|
|
|
|
2024-03-20 17:55:25 +01:00
|
|
|
return CommandAlias::SUCCESS;
|
2024-03-20 17:48:13 +01:00
|
|
|
}
|
|
|
|
$this->friendlyPositive('Encryption keys have been created, nice!');
|
2024-03-20 17:55:25 +01:00
|
|
|
|
2024-03-20 17:48:13 +01:00
|
|
|
return CommandAlias::SUCCESS;
|
|
|
|
}
|
|
|
|
}
|