Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
28 / 28
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
Migration410Alpha3
100.00% covered (success)
100.00%
28 / 28
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 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
100.00% covered (success)
100.00%
25 / 25
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * Migration for phpMyFAQ 4.1.0-alpha.3.
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\Setup\Migration\AbstractMigration;
23use phpMyFAQ\Setup\Migration\Operations\OperationRecorder;
24
25readonly class Migration410Alpha3 extends AbstractMigration
26{
27    public function getVersion(): string
28    {
29        return '4.1.0-alpha.3';
30    }
31
32    public function getDependencies(): array
33    {
34        return ['4.1.0-alpha.2'];
35    }
36
37    public function getDescription(): string
38    {
39        return 'LLMs.txt config, LDAP group integration, search optimization indexes';
40    }
41
42    public function up(OperationRecorder $recorder): void
43    {
44        $llmsText =
45            "# phpMyFAQ LLMs.txt\n\n"
46            . "This file provides information about the AI/LLM training data availability for this FAQ system.\n\n"
47            . "Contact: Please see the contact information on the main website.\n\n"
48            . "The FAQ content in this system is available for LLM training purposes.\n"
49            . "Please respect the licensing terms and usage guidelines of the content.\n\n"
50            . 'For more information about this FAQ system, visit: https://www.phpmyfaq.de';
51
52        $recorder->addConfig('seo.contentLlmsText', $llmsText);
53
54        // LDAP group integration
55        $recorder->addConfig('ldap.ldap_use_group_restriction', 'false');
56        $recorder->addConfig('ldap.ldap_group_allowed_groups', '');
57        $recorder->addConfig('ldap.ldap_group_auto_assign', 'false');
58        $recorder->addConfig('ldap.ldap_group_mapping', '');
59
60        // Search optimization configuration
61        $recorder->addConfig('search.popularSearchTimeWindow', '180');
62
63        // Performance indexes for faqsearches table
64        $recorder->addSql(
65            $this->createIndex('faqsearches', 'idx_faqsearches_searchterm', 'searchterm'),
66            'Create searchterm index on faqsearches',
67        );
68
69        $recorder->addSql(
70            $this->createIndex('faqsearches', 'idx_faqsearches_date_term', ['searchdate', 'searchterm']),
71            'Create date_term index on faqsearches',
72        );
73
74        $recorder->addSql(
75            $this->createIndex('faqsearches', 'idx_faqsearches_date_term_lang', ['searchdate', 'searchterm', 'lang']),
76            'Create date_term_lang index on faqsearches',
77        );
78    }
79}