aboutsummaryrefslogtreecommitdiff
path: root/db/migrations/1.289_tic10318_http_proxy.php
blob: 9f84f41e37b66d51a46260fa3a88aef2c9f559dd (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
35
36
37
38
39
40
<?php
class Tic10318HttpProxy extends Migration
{
    public function description()
    {
        return 'add config option for http proxy';
    }

    public function up()
    {
        $db = DBManager::get();

        $stmt = $db->prepare('INSERT IGNORE INTO config (field, value, type, `range`, section, mkdate, chdate, description)
                              VALUES (:name, :value, :type, :range, :section, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), :description)');
        $stmt->execute([
            'name'        => 'HTTP_PROXY',
            'description' => 'externe http Anfragen über proxy',
            'range'       => 'global',
            'type'        => 'string',
            'value'       => '',
            'section'     => 'global'
        ]);
        $stmt->execute([
            'name'        => 'HTTP_PROXY_IGNORE',
            'description' => 'Kommaseparierte Liste mit Hostnamen, die nicht über Proxy aufgerufen werden sollen',
            'range'       => 'global',
            'type'        => 'string',
            'value'       => '',
            'section'     => 'global'
        ]);
    }

    public function down()
    {
        $db = DBManager::get();

        $db->execute('DELETE config, config_values FROM config LEFT JOIN config_values USING(field) WHERE field = ?', ['HTTP_PROXY']);
        $db->execute('DELETE config, config_values FROM config LEFT JOIN config_values USING(field) WHERE field = ?', ['HTTP_PROXY_IGNORE']);
    }
}