2019-03-23 08:10:59 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* ReportIntegrity.php
|
2020-01-23 20:35:02 +01:00
|
|
|
* Copyright (c) 2020 james@firefly-iii.org
|
2019-03-23 08:10:59 +01:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2019-03-23 08:10:59 +01:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* 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.
|
2019-03-23 08:10:59 +01:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2019-03-23 08:10:59 +01:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-02 06:37:26 +02:00
|
|
|
* GNU Affero General Public License for more details.
|
2019-03-23 08:10:59 +01:00
|
|
|
*
|
2019-10-02 06:37:26 +02:00
|
|
|
* 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/>.
|
2019-03-23 08:10:59 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace FireflyIII\Console\Commands\Integrity;
|
|
|
|
|
2023-06-20 07:16:56 +02:00
|
|
|
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
2019-03-23 08:10:59 +01:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class ReportIntegrity
|
|
|
|
*/
|
|
|
|
class ReportIntegrity extends Command
|
|
|
|
{
|
2023-06-20 07:16:56 +02:00
|
|
|
use ShowsFriendlyMessages;
|
|
|
|
|
2019-03-23 08:10:59 +01:00
|
|
|
protected $description = 'Will report on the integrity of your database.';
|
2023-11-05 09:54:53 +01:00
|
|
|
|
2024-01-01 14:43:56 +01:00
|
|
|
protected $signature = 'firefly-iii:report-integrity';
|
2019-03-23 08:10:59 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
|
|
|
public function handle(): int
|
|
|
|
{
|
|
|
|
// if table does not exist, return false
|
2023-12-20 19:35:52 +01:00
|
|
|
if (!\Schema::hasTable('users')) {
|
2019-03-23 08:10:59 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
$commands = [
|
2024-11-06 19:42:09 +01:00
|
|
|
'firefly-iii:add-timezones-to-dates',
|
2023-04-16 07:33:12 +02:00
|
|
|
'firefly-iii:create-group-memberships',
|
2019-03-23 08:10:59 +01:00
|
|
|
'firefly-iii:report-empty-objects',
|
|
|
|
'firefly-iii:report-sum',
|
2023-05-07 20:17:29 +02:00
|
|
|
'firefly-iii:upgrade-group-information',
|
2019-03-23 08:10:59 +01:00
|
|
|
];
|
|
|
|
foreach ($commands as $command) {
|
2023-06-20 07:16:56 +02:00
|
|
|
$this->friendlyLine(sprintf('Now executing %s', $command));
|
2023-04-16 07:33:12 +02:00
|
|
|
$this->call($command);
|
2019-03-23 08:10:59 +01:00
|
|
|
}
|
2020-03-21 15:43:41 +01:00
|
|
|
|
2019-03-23 08:10:59 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2019-08-17 12:09:03 +02:00
|
|
|
}
|