|
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
|
|
|
* Template log store settings. |
|
19
|
|
|
* |
|
20
|
|
|
* @package logstore_fluentd |
|
21
|
|
|
* @copyright 2015 Daniel Neis (based on standard log store from Petr Skoda) |
|
22
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
defined('MOODLE_INTERNAL') || die(); |
|
26
|
|
|
|
|
27
|
|
|
if ($hassiteconfig) { |
|
28
|
|
|
|
|
29
|
|
|
global $CFG; |
|
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
$settings->add(new admin_setting_configcheckbox('logstore_fluentd/logguests', |
|
32
|
|
|
new lang_string('logguests', 'core_admin'), |
|
33
|
|
|
new lang_string('logguests_help', 'core_admin'), 1)); |
|
34
|
|
|
|
|
35
|
|
|
$options = array( |
|
36
|
|
|
0 => new lang_string('neverdeletelogs'), |
|
37
|
|
|
1000 => new lang_string('numdays', '', 1000), |
|
38
|
|
|
365 => new lang_string('numdays', '', 365), |
|
39
|
|
|
180 => new lang_string('numdays', '', 180), |
|
40
|
|
|
150 => new lang_string('numdays', '', 150), |
|
41
|
|
|
120 => new lang_string('numdays', '', 120), |
|
42
|
|
|
90 => new lang_string('numdays', '', 90), |
|
43
|
|
|
60 => new lang_string('numdays', '', 60), |
|
44
|
|
|
35 => new lang_string('numdays', '', 35), |
|
45
|
|
|
10 => new lang_string('numdays', '', 10), |
|
46
|
|
|
5 => new lang_string('numdays', '', 5), |
|
47
|
|
|
2 => new lang_string('numdays', '', 2)); |
|
48
|
|
|
$settings->add(new admin_setting_configselect('logstore_fluentd/loglifetime', |
|
49
|
|
|
new lang_string('loglifetime', 'core_admin'), |
|
50
|
|
|
new lang_string('configloglifetime', 'core_admin'), 0, $options)); |
|
51
|
|
|
|
|
52
|
|
|
$settings->add(new admin_setting_configtext('logstore_fluentd/buffersize', |
|
53
|
|
|
get_string('buffersize', 'logstore_fluentd'), |
|
54
|
|
|
'', '50', PARAM_INT)); |
|
55
|
|
|
|
|
56
|
|
|
$settings->add(new admin_setting_configtext('logstore_fluentd/fluentd_url', |
|
57
|
|
|
get_string('fluentd_url', 'logstore_fluentd'), |
|
58
|
|
|
'', 'localhost', PARAM_TEXT)); |
|
59
|
|
|
|
|
60
|
|
|
$settings->add(new admin_setting_configtext('logstore_fluentd/fluentd_port', |
|
61
|
|
|
get_string('fluentd_port', 'logstore_fluentd'), |
|
62
|
|
|
'', '24224', PARAM_INT)); |
|
63
|
|
|
|
|
64
|
|
|
$settings->add(new admin_setting_configtext('logstore_fluentd/fluentd_tag', |
|
65
|
|
|
get_string('fluentd_tag', 'logstore_fluentd'), |
|
66
|
|
|
'', 'fluentd.moodle', PARAM_TEXT)); |
|
67
|
|
|
} |
|
68
|
|
|
|
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state