aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.72_config_ajax_autocomplete_disabled.php
blob: a23fa92eb0c7415834164c26568ed24a67023bfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php

class ConfigAjaxAutocompleteDisabled extends Migration {

    function description() {
        return 'Inserts a new config-variable to enable or disable ajax autocomplete used by QuickSearch.';
    }

    function up() {
        $options[] =
            [
            'name'        => 'AJAX_AUTOCOMPLETE_DISABLED',
            'type'        => 'boolean',
            'value'       => 0,
            'section'     => '',
            'description' => 'Sollen alle QuickSearches deaktiviertes Autocomplete haben? Wenn es zu Performanceproblemen kommt, kann es sich lohnen, diese Variable auf true zu stellen.'
            ];

        $stmt = DBManager::get()->prepare("
                INSERT IGNORE INTO config
                    (config_id, field, value, is_default, type, section, mkdate, chdate, description)
                VALUES
                    (MD5(:name), :name, :value, 1, :type, :section, UNIX_TIMESTAMP(),  UNIX_TIMESTAMP(), :description)
                ");

        foreach ($options as $option) {
            $stmt->execute($option);
        }
    }

    function down() {
        $db = DBManager::get()->exec("DELETE FROM config WHERE field = 'AJAX_AUTOCOMPLETE_DISABLED'");
    }
}