MDL-58651 logstore_database: Add ability to not send database options
[moodle.git] / admin / tool / log / store / database / settings.php
CommitLineData
7eaca5a8
1<?php
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * External database log store settings.
19 *
20 * @package logstore_database
21 * @copyright 2013 Petr Skoda {@link http://skodak.org}
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die();
26
27if ($hassiteconfig) {
ed8f7c30
AA
28 $testurl = new moodle_url('/admin/tool/log/store/database/test_settings.php', array('sesskey' => sesskey()));
29 $test = new admin_externalpage('logstoredbtestsettings', get_string('testsettings', 'logstore_database'),
30 $testurl, 'moodle/site:config', true);
31 $ADMIN->add('logging', $test);
7eaca5a8 32
ed8f7c30
AA
33 $drivers = \logstore_database\helper::get_drivers();
34 // Database settings.
35 $link = html_writer::link($testurl, get_string('testsettings', 'logstore_database'), array('target' => '_blank'));
36 $settings->add(new admin_setting_heading('dbsettings', get_string('databasesettings', 'logstore_database'),
0852f9c6 37 get_string('databasesettings_help', 'logstore_database', $link)));
ed8f7c30 38 $settings->add(new admin_setting_configselect('logstore_database/dbdriver', get_string('databasetypehead', 'install'), '',
0852f9c6 39 '', $drivers));
7eaca5a8 40
ed8f7c30
AA
41 $settings->add(new admin_setting_configtext('logstore_database/dbhost', get_string('databasehost', 'install'), '', ''));
42 $settings->add(new admin_setting_configtext('logstore_database/dbuser', get_string('databaseuser', 'install'), '', ''));
bdaf91fd 43 $settings->add(new admin_setting_configpasswordunmask('logstore_database/dbpass', get_string('databasepass', 'install'), '', ''));
ed8f7c30
AA
44 $settings->add(new admin_setting_configtext('logstore_database/dbname', get_string('databasename', 'install'), '', ''));
45 $settings->add(new admin_setting_configtext('logstore_database/dbtable', get_string('databasetable', 'logstore_database'),
0852f9c6 46 get_string('databasetable_help', 'logstore_database'), ''));
7eaca5a8 47
ed8f7c30 48 $settings->add(new admin_setting_configcheckbox('logstore_database/dbpersist', get_string('databasepersist',
0852f9c6 49 'logstore_database'), '', '0'));
ed8f7c30 50 $settings->add(new admin_setting_configtext('logstore_database/dbsocket', get_string('databasesocket', 'install'), '',
0852f9c6 51 ''));
ed8f7c30
AA
52 $settings->add(new admin_setting_configtext('logstore_database/dbport', get_string('databaseport', 'install'), '', ''));
53 $settings->add(new admin_setting_configtext('logstore_database/dbschema', get_string('databaseschema',
0852f9c6 54 'logstore_database'), '', ''));
ed8f7c30 55 $settings->add(new admin_setting_configtext('logstore_database/dbcollation', get_string('databasecollation',
0852f9c6 56 'logstore_database'), '', ''));
556ceb20
AO
57 $settings->add(new admin_setting_configcheckbox('logstore_database/dbhandlesoptions', get_string('databasehandlesoptions',
58 'logstore_database'), get_string('databasehandlesoptions_help', 'logstore_database'), '0'));
ed8f7c30
AA
59 $settings->add(new admin_setting_configtext('logstore_database/buffersize', get_string('buffersize',
60 'logstore_database'), get_string('buffersize_help', 'logstore_database'), 50));
7eaca5a8 61
ed8f7c30
AA
62 // Filters.
63 $settings->add(new admin_setting_heading('filters', get_string('filters', 'logstore_database'), get_string('filters_help',
0852f9c6 64 'logstore_database')));
ed8f7c30
AA
65 $settings->add(new admin_setting_configcheckbox('logstore_database/logguests', get_string('logguests',
66 'logstore_database'), '', '0'));
67 $levels = \logstore_database\helper::get_level_options();
a3cfbccd
AA
68 $settings->add(new admin_setting_configmulticheckbox('logstore_database/includelevels', get_string('includelevels',
69 'logstore_database'), '', $levels, $levels));
ed8f7c30 70 $actions = \logstore_database\helper::get_action_options();
a3cfbccd
AA
71 $settings->add(new admin_setting_configmulticheckbox('logstore_database/includeactions', get_string('includeactions',
72 'logstore_database'), '', $actions, $actions));
7eaca5a8 73}