forked from catalyst/moodle-tool_crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
213 lines (182 loc) · 11.4 KB
/
settings.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* link checker robot local plugin settings
*
* @package tool_crawler
* @author Brendan Heywood <[email protected]>
* @copyright Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot . '/admin/tool/crawler/constants.php');
if ($hassiteconfig) {
// Site admin reports.
$cat = new admin_category('tool_crawler_cat', 'Link crawler');
$ADMIN->add('reports', $cat);
$ADMIN->add('tool_crawler_cat', new admin_externalpage('tool_crawler_status',
get_string('status', 'tool_crawler'),
$CFG->wwwroot . '/admin/tool/crawler/index.php') );
$ADMIN->add('tool_crawler_cat', new admin_externalpage('tool_crawler_queued',
get_string('queued', 'tool_crawler'),
$CFG->wwwroot . '/admin/tool/crawler/report.php?report=queued') );
$ADMIN->add('tool_crawler_cat', new admin_externalpage('tool_crawler_recent',
get_string('recent', 'tool_crawler'),
$CFG->wwwroot . '/admin/tool/crawler/report.php?report=recent') );
$ADMIN->add('tool_crawler_cat', new admin_externalpage('tool_crawler_broken',
get_string('broken', 'tool_crawler'),
$CFG->wwwroot . '/admin/tool/crawler/report.php?report=broken') );
$ADMIN->add('tool_crawler_cat', new admin_externalpage('tool_crawler_oversize',
get_string('oversize', 'tool_crawler'),
$CFG->wwwroot . '/admin/tool/crawler/report.php?report=oversize') );
// Local plugin settings.
$settings = new admin_settingpage('tool_crawler', get_string('pluginname', 'tool_crawler'));
$ADMIN->add('tools', $settings);
if (!during_initial_install()) {
require("$CFG->dirroot/admin/tool/crawler/tabs.php");
$settings->add(new admin_setting_heading('tool_crawler',
'',
$tabs
));
$settings->add(new admin_setting_configtext('tool_crawler/seedurl',
new lang_string('seedurl', 'tool_crawler'),
new lang_string('seedurldesc', 'tool_crawler'),
'/' ));
$settings->add(new admin_setting_configtext('tool_crawler/botusername',
new lang_string('botusername', 'tool_crawler'),
new lang_string('botusernamedesc', 'tool_crawler'),
'moodlebot' ));
$settings->add(new admin_setting_configpasswordunmask('tool_crawler/botpassword',
new lang_string('botpassword', 'tool_crawler'),
new lang_string('botpassworddesc', 'tool_crawler'),
'moodlebot' ));
$settings->add(new admin_setting_configtext('tool_crawler/useragent',
new lang_string('useragent', 'tool_crawler'),
new lang_string('useragentdesc', 'tool_crawler'),
'' ));
$settings->add(new admin_setting_configtextarea('tool_crawler/excludeexturl',
new lang_string('excludeexturl', 'tool_crawler'),
new lang_string('excludeexturldesc', 'tool_crawler'),
'http://moodle.org/
http://validator.w3.org/
http://www.contentquality.com/' ));
$settings->add(new admin_setting_configtextarea('tool_crawler/excludemdlurl',
new lang_string('excludemdlurl', 'tool_crawler'),
new lang_string('excludemdlurldesc', 'tool_crawler'),
"grading
/admin
/blog
/badges
/blocks/quickmail
/calendar
/enrol
/help/
/login
/message
/report
/rss
/user
/tag/" ));
$settings->add(new admin_setting_configtextarea('tool_crawler/excludemdlparam',
new lang_string('excludemdlparam', 'tool_crawler'),
new lang_string('excludemdlparamdesc', 'tool_crawler'),
"sesskey
time
lang
useridlistid
" ));
$settings->add(new admin_setting_configtextarea('tool_crawler/excludemdldom',
new lang_string('excludemdldom', 'tool_crawler'),
new lang_string('excludemdldomdesc', 'tool_crawler'),
".block.block_settings
.block.block_book_toc
.block.block_calendar_month
.block.block_navigation
.block.block_cqu_assessment" ));
$settings->add(new admin_setting_configtextarea('tool_crawler/excludecourses',
new lang_string('excludecourses', 'tool_crawler'),
new lang_string('excludecoursesdesc', 'tool_crawler'),
"" ));
$options = array(
0 => new lang_string('no'),
1 => new lang_string('yes'),
);
$settings->add(new admin_setting_configselect('tool_crawler/uselogs',
new lang_string('uselogs', 'tool_crawler'),
new lang_string('uselogsdesc', 'tool_crawler'),
0,
$options));
$settings->add(new admin_setting_configtext('tool_crawler/recentactivity',
new lang_string('recentactivity', 'tool_crawler'),
get_string('recentactivitydesc', 'tool_crawler'), '1'));
// The default moodle level of concurrency is 3 so if we spawned 10 crawler
// tasks every minute then moodle may not ever be able to keep up and it will
// block other tasks from being processed in a timely fashion.
// So default to 1 to be effectively not parallel by default.
$settings->add(new admin_setting_configtext('tool_crawler/max_workers',
new lang_string('max_workers', 'tool_crawler'),
new lang_string('max_workersdesc', 'tool_crawler'),
'1' ));
$settings->add(new admin_setting_configtext('tool_crawler/maxtime',
new lang_string('maxtime', 'tool_crawler'),
new lang_string('maxtimedesc', 'tool_crawler'),
'60' ));
$settings->add(new admin_setting_configtext('tool_crawler/maxcrontime',
new lang_string('maxcrontime', 'tool_crawler'),
new lang_string('maxcrontimedesc', 'tool_crawler'),
'60' ));
$settings->add(new admin_setting_configtext('tool_crawler/bigfilesize',
new lang_string('bigfilesize', 'tool_crawler'),
new lang_string('bigfilesizedesc', 'tool_crawler'),
'1' ));
$settings->add(new admin_setting_configcheckbox('tool_crawler/usehead',
new lang_string('usehead', 'tool_crawler'),
new lang_string('useheaddesc', 'tool_crawler'),
'0' ));
$options = array();
foreach (array(
TOOL_CRAWLER_NETWORKSTRAIN_REASONABLE,
TOOL_CRAWLER_NETWORKSTRAIN_RESOLUTE,
TOOL_CRAWLER_NETWORKSTRAIN_EXCESSIVE,
TOOL_CRAWLER_NETWORKSTRAIN_WASTEFUL,
) as $option) {
$options[$option] = new lang_string('networkstrain' . $option, 'tool_crawler');
}
$settings->add(new admin_setting_configselect('tool_crawler/networkstrain',
new lang_string('networkstrain', 'tool_crawler'),
new lang_string('networkstraindesc', 'tool_crawler'),
TOOL_CRAWLER_NETWORKSTRAIN_WASTEFUL,
$options));
$options = array(
86400 => new lang_string('secondstotime86400'),
604800 => new lang_string('secondstotime604800'),
2620800 => new lang_string('nummonths', 'moodle', 1),
5241600 => new lang_string('nummonths', 'moodle', 2),
7862400 => new lang_string('nummonths', 'moodle', 3),
15724800 => new lang_string('nummonths', 'moodle', 6),
0 => new lang_string('never')
);
$settings->add(new admin_setting_configselect('tool_crawler/retentionperiod',
new lang_string('retentionperiod', 'tool_crawler'),
new lang_string('retentionperioddesc', 'tool_crawler'),
2620800,
$options));
$settings->add(new admin_setting_configcheckbox('tool_crawler/disablebot',
new lang_string('disablebot', 'tool_crawler'),
new lang_string('disablebotdesc', 'tool_crawler'),
'0' ));
}
}