Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
50.00% covered (danger)
50.00%
3 / 6
75.00% covered (warning)
75.00%
3 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
Migration410Alpha2
50.00% covered (danger)
50.00%
3 / 6
75.00% covered (warning)
75.00%
3 / 4
6.00
0.00% covered (danger)
0.00%
0 / 1
 getVersion
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDependencies
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getDescription
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 up
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3/**
4 * Migration for phpMyFAQ 4.1.0-alpha.2.
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public License,
7 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
8 * obtain one at https://mozilla.org/MPL/2.0/.
9 *
10 * @package   phpMyFAQ
11 * @author    Thorsten Rinne <thorsten@phpmyfaq.de>
12 * @copyright 2023-2026 phpMyFAQ Team
13 * @license   https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
14 * @link      https://www.phpmyfaq.de
15 * @since     2026-01-25
16 */
17
18declare(strict_types=1);
19
20namespace phpMyFAQ\Setup\Migration\Versions;
21
22use phpMyFAQ\Enums\PermissionType;
23use phpMyFAQ\Setup\Migration\AbstractMigration;
24use phpMyFAQ\Setup\Migration\Operations\OperationRecorder;
25
26readonly class Migration410Alpha2 extends AbstractMigration
27{
28    public function getVersion(): string
29    {
30        return '4.1.0-alpha.2';
31    }
32
33    public function getDependencies(): array
34    {
35        return ['4.1.0-alpha'];
36    }
37
38    public function getDescription(): string
39    {
40        return 'Admin session timeout counter, OpenSearch config, FAQ translate permission';
41    }
42
43    public function up(OperationRecorder $recorder): void
44    {
45        $recorder->addConfig('security.enableAdminSessionTimeoutCounter', true);
46        $recorder->addConfig('search.enableOpenSearch', false);
47
48        // Add new permission to translate FAQs
49        $recorder->grantPermission(PermissionType::FAQ_TRANSLATE->value, 'Right to translate FAQs');
50    }
51}