1 | <?php |
||
2 | |||
3 | /** |
||
4 | * webtrees: online genealogy |
||
5 | * Copyright (C) 2025 webtrees development team |
||
6 | * This program is free software: you can redistribute it and/or modify |
||
7 | * it under the terms of the GNU General Public License as published by |
||
8 | * the Free Software Foundation, either version 3 of the License, or |
||
9 | * (at your option) any later version. |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | * GNU General Public License for more details. |
||
14 | * You should have received a copy of the GNU General Public License |
||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
||
16 | */ |
||
17 | |||
18 | declare(strict_types=1); |
||
19 | |||
20 | namespace Fisharebest\Webtrees\Services; |
||
21 | |||
22 | use Fisharebest\Webtrees\Schema\MigrationInterface; |
||
23 | use Fisharebest\Webtrees\Schema\SeedDefaultResnTable; |
||
0 ignored issues
–
show
|
|||
24 | use Fisharebest\Webtrees\Schema\SeedGedcomTable; |
||
25 | use Fisharebest\Webtrees\Schema\SeedUserTable; |
||
26 | use Fisharebest\Webtrees\Site; |
||
27 | use PDOException; |
||
28 | |||
29 | /** |
||
30 | * Update the database schema. |
||
31 | */ |
||
32 | class MigrationService |
||
33 | { |
||
34 | /** |
||
35 | * Run a series of scripts to bring the database schema up to date. |
||
36 | * |
||
37 | * @param string $namespace Where to find our MigrationXXX classes |
||
38 | * @param string $schema_name Which schema to update. |
||
39 | * @param int $target_version Upgrade to this version |
||
40 | * |
||
41 | * @return bool Were any updates applied |
||
42 | * @throws PDOException |
||
43 | */ |
||
44 | public function updateSchema(string $namespace, string $schema_name, int $target_version): bool |
||
45 | { |
||
46 | try { |
||
47 | $current_version = (int) Site::getPreference($schema_name); |
||
48 | } catch (PDOException) { |
||
49 | // During initial installation, the site_preference table won’t exist. |
||
50 | $current_version = 0; |
||
51 | } |
||
52 | |||
53 | $updates_applied = false; |
||
54 | |||
55 | // Update the schema, one version at a time. |
||
56 | while ($current_version < $target_version) { |
||
57 | $class = $namespace . '\\Migration' . $current_version; |
||
58 | /** @var MigrationInterface $migration */ |
||
59 | $migration = new $class(); |
||
60 | $migration->upgrade(); |
||
61 | $current_version++; |
||
62 | Site::setPreference($schema_name, (string) $current_version); |
||
63 | $updates_applied = true; |
||
64 | } |
||
65 | |||
66 | return $updates_applied; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * Write default data to the database. |
||
71 | * |
||
72 | * @return void |
||
73 | */ |
||
74 | public function seedDatabase(): void |
||
75 | { |
||
76 | (new SeedUserTable())->run(); |
||
77 | (new SeedGedcomTable())->run(); |
||
78 | (new SeedDefaultResnTable())->run(); |
||
79 | } |
||
80 | } |
||
81 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths