MDL-51853 calendar: Whitespace fix
[moodle.git] / admin / settings / server.php
blob2ad2777baba68d2307e659e38a989668d84eee02
1 <?php
3 // This file defines settingpages and externalpages under the "server" category
5 if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
8 // "systempaths" settingpage
9 $temp = new admin_settingpage('systempaths', new lang_string('systempaths','admin'));
11 $temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'), new lang_string('configpathtodu', 'admin'), ''));
12 $temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
13 $temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
14 $temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
15 $temp->add(new admin_setting_configexecutable('pathtounoconv', new lang_string('pathtounoconv', 'admin'), new lang_string('pathtounoconv_help', 'admin'), '/usr/bin/unoconv'));
16 $ADMIN->add('server', $temp);
20 // "supportcontact" settingpage
21 $temp = new admin_settingpage('supportcontact', new lang_string('supportcontact','admin'));
22 $primaryadmin = get_admin();
23 if ($primaryadmin) {
24 $primaryadminemail = $primaryadmin->email;
25 $primaryadminname = fullname($primaryadmin, true);
26 } else {
27 // no defaults during installation - admin user must be created first
28 $primaryadminemail = NULL;
29 $primaryadminname = NULL;
31 $temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
32 new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
33 $setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
34 new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL);
35 $setting->set_force_ltr(true);
36 $temp->add($setting);
37 $temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
38 $ADMIN->add('server', $temp);
41 // "sessionhandling" settingpage
42 $temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin'));
43 if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
44 $temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'), new lang_string('configdbsessions', 'admin'), 0));
46 $temp->add(new admin_setting_configselect('sessiontimeout', new lang_string('sessiontimeout', 'admin'), new lang_string('configsessiontimeout', 'admin'), 7200, array(14400 => new lang_string('numhours', '', 4),
47 10800 => new lang_string('numhours', '', 3),
48 7200 => new lang_string('numhours', '', 2),
49 5400 => new lang_string('numhours', '', '1.5'),
50 3600 => new lang_string('numminutes', '', 60),
51 2700 => new lang_string('numminutes', '', 45),
52 1800 => new lang_string('numminutes', '', 30),
53 900 => new lang_string('numminutes', '', 15),
54 300 => new lang_string('numminutes', '', 5))));
55 $temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'), new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
56 $temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'), new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
57 $temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'), new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
58 $ADMIN->add('server', $temp);
61 // "stats" settingpage
62 $temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
63 $temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'), new lang_string('configstatsfirstrun', 'admin'), 'none', array('none' => new lang_string('none'),
64 60*60*24*7 => new lang_string('numweeks','moodle',1),
65 60*60*24*14 => new lang_string('numweeks','moodle',2),
66 60*60*24*21 => new lang_string('numweeks','moodle',3),
67 60*60*24*28 => new lang_string('nummonths','moodle',1),
68 60*60*24*56 => new lang_string('nummonths','moodle',2),
69 60*60*24*84 => new lang_string('nummonths','moodle',3),
70 60*60*24*112 => new lang_string('nummonths','moodle',4),
71 60*60*24*140 => new lang_string('nummonths','moodle',5),
72 60*60*24*168 => new lang_string('nummonths','moodle',6),
73 'all' => new lang_string('all') )));
74 $temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'), new lang_string('configstatsmaxruntime3', 'admin'), 0, array(0 => new lang_string('untilcomplete'),
75 60*30 => '10 '.new lang_string('minutes'),
76 60*30 => '30 '.new lang_string('minutes'),
77 60*60 => '1 '.new lang_string('hour'),
78 60*60*2 => '2 '.new lang_string('hours'),
79 60*60*3 => '3 '.new lang_string('hours'),
80 60*60*4 => '4 '.new lang_string('hours'),
81 60*60*5 => '5 '.new lang_string('hours'),
82 60*60*6 => '6 '.new lang_string('hours'),
83 60*60*7 => '7 '.new lang_string('hours'),
84 60*60*8 => '8 '.new lang_string('hours') )));
85 $temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'), new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
86 $temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'), new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
87 $ADMIN->add('server', $temp);
90 // "http" settingpage
91 $temp = new admin_settingpage('http', new lang_string('http', 'admin'));
92 $temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'), new lang_string('configslasharguments', 'admin'), 1));
93 $temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', ''));
94 $options = array(
95 0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
96 GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
97 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
98 GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
99 $temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'), new lang_string('configgetremoteaddrconf', 'admin'), 0, $options));
101 $temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'), new lang_string('webproxyinfo', 'admin')));
102 $temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'), new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
103 $temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'), new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
104 $options = array('HTTP'=>'HTTP');
105 if (defined('CURLPROXY_SOCKS5')) {
106 $options['SOCKS5'] = 'SOCKS5';
108 $temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'), new lang_string('configproxytype','admin'), 'HTTP', $options));
109 $temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'), new lang_string('configproxyuser', 'admin'), ''));
110 $temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'), new lang_string('configproxypassword', 'admin'), ''));
111 $temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'), new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
112 $ADMIN->add('server', $temp);
114 $temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin'));
115 $options = array(0=>new lang_string('disable'), 1=>new lang_string('enable'));
116 $temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'),
117 new lang_string('helpsitemaintenance', 'admin'), 0, $options));
118 $temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'),
119 '', ''));
120 $ADMIN->add('server', $temp);
122 $temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin'));
123 $temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'), new lang_string('configdeleteunconfirmed', 'admin'), 168, array(0 => new lang_string('never'),
124 168 => new lang_string('numdays', '', 7),
125 144 => new lang_string('numdays', '', 6),
126 120 => new lang_string('numdays', '', 5),
127 96 => new lang_string('numdays', '', 4),
128 72 => new lang_string('numdays', '', 3),
129 48 => new lang_string('numdays', '', 2),
130 24 => new lang_string('numdays', '', 1),
131 12 => new lang_string('numhours', '', 12),
132 6 => new lang_string('numhours', '', 6),
133 1 => new lang_string('numhours', '', 1))));
135 $temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'), new lang_string('configdeleteincompleteusers', 'admin'), 0, array(0 => new lang_string('never'),
136 168 => new lang_string('numdays', '', 7),
137 144 => new lang_string('numdays', '', 6),
138 120 => new lang_string('numdays', '', 5),
139 96 => new lang_string('numdays', '', 4),
140 72 => new lang_string('numdays', '', 3),
141 48 => new lang_string('numdays', '', 2),
142 24 => new lang_string('numdays', '', 1))));
145 $temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
146 new lang_string('disablegradehistory_help', 'grades'), 0));
148 $temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'),
149 new lang_string('gradehistorylifetime_help', 'grades'), 0, array(0 => new lang_string('neverdeletehistory', 'grades'),
150 1000 => new lang_string('numdays', '', 1000),
151 365 => new lang_string('numdays', '', 365),
152 180 => new lang_string('numdays', '', 180),
153 150 => new lang_string('numdays', '', 150),
154 120 => new lang_string('numdays', '', 120),
155 90 => new lang_string('numdays', '', 90),
156 60 => new lang_string('numdays', '', 60),
157 30 => new lang_string('numdays', '', 30))));
159 $temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
160 new lang_string('configtempdatafoldercleanup', 'admin'), 168, array(
161 1 => new lang_string('numhours', '', 1),
162 3 => new lang_string('numhours', '', 3),
163 6 => new lang_string('numhours', '', 6),
164 9 => new lang_string('numhours', '', 9),
165 12 => new lang_string('numhours', '', 12),
166 18 => new lang_string('numhours', '', 18),
167 24 => new lang_string('numhours', '', 24),
168 48 => new lang_string('numdays', '', 2),
169 168 => new lang_string('numdays', '', 7),
170 )));
172 $ADMIN->add('server', $temp);
176 $ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
177 $ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
180 // "performance" settingpage
181 $temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
183 // Memory limit options for large administration tasks.
184 $memoryoptions = array(
185 '64M' => '64M',
186 '128M' => '128M',
187 '256M' => '256M',
188 '512M' => '512M',
189 '1024M' => '1024M',
190 '2048M' => '2048M');
192 // Allow larger memory usage for 64-bit sites only.
193 if (PHP_INT_SIZE === 8) {
194 $memoryoptions['3072M'] = '3072M';
195 $memoryoptions['4096M'] = '4096M';
198 $temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
199 new lang_string('configextramemorylimit', 'admin'), '512M',
200 $memoryoptions));
201 $temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
202 new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT));
204 $temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
205 new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
207 $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'),
208 new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
210 $ADMIN->add('server', $temp);
213 $ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('hubs', 'admin'),
214 "$CFG->wwwroot/$CFG->admin/registration/index.php"));
216 // E-mail settings.
217 $ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
219 $temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
221 $temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
222 new lang_string('smtpdetail', 'admin')));
223 $temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
224 new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
225 $options = array('' => new lang_string('none', 'admin'), 'ssl' => 'SSL', 'tls' => 'TLS');
226 $temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
227 new lang_string('configsmtpsecure', 'admin'), '', $options));
228 $authtypeoptions = array('LOGIN' => 'LOGIN', 'PLAIN' => 'PLAIN', 'NTLM' => 'NTLM', 'CRAM-MD5' => 'CRAM-MD5');
229 $temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
230 new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
231 $temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
232 new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
233 $temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
234 new lang_string('configsmtpuser', 'admin'), ''));
235 $temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
236 new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
237 $temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
238 new lang_string('noreplydomaindetail', 'admin')));
239 $temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
240 new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL));
241 $temp->add(new admin_setting_configtextarea('allowedemaildomains',
242 new lang_string('allowedemaildomains', 'admin'),
243 new lang_string('configallowedemaildomains', 'admin'),
244 ''));
245 $temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
246 new lang_string('doesnotfitdetail', 'admin')));
247 $charsets = get_list_of_charsets();
248 unset($charsets['UTF-8']); // Not needed here.
249 $options = array();
250 $options['0'] = 'UTF-8';
251 $options = array_merge($options, $charsets);
252 $temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
253 new lang_string('configsitemailcharset','admin'), '0', $options));
254 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
255 new lang_string('configallowusermailcharset', 'admin'), 0));
256 $temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
257 new lang_string('configallowattachments', 'admin'), 1));
258 $options = array('LF' => 'LF', 'CRLF' => 'CRLF');
259 $temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
260 new lang_string('configmailnewline', 'admin'), 'LF', $options));
262 $choices = array(new lang_string('never', 'admin'),
263 new lang_string('always', 'admin'),
264 new lang_string('onlynoreply', 'admin'));
265 $temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
266 new lang_string('configemailfromvia', 'admin'), 1, $choices));
268 $ADMIN->add('email', $temp);
270 // "update notifications" settingpage
271 if (empty($CFG->disableupdatenotifications)) {
272 $temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
273 $temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
274 new lang_string('updateautocheck_desc', 'core_admin'), 1));
275 $temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
276 new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
277 array(
278 MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
279 MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
280 MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
281 MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
282 )));
283 $temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
284 new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
285 $ADMIN->add('server', $temp);
288 } // end of speedup