MDL-26140 hide unfinished experimental DTL pages
[moodle.git] / admin / settings / server.php
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', get_string('systempaths','admin'));
10 $temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
11                                                                                                                                                           '1' => get_string('gd1'),
12                                                                                                                                                           '2' => get_string('gd2'))));
13 $temp->add(new admin_setting_configexecutable('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), ''));
14 $temp->add(new admin_setting_configexecutable('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), ''));
15 $temp->add(new admin_setting_configexecutable('pathtodot', get_string('pathtodot', 'admin'), get_string('pathtodot_help', 'admin'), ''));
16 $ADMIN->add('server', $temp);
20 // "email" settingpage
21 $temp = new admin_settingpage('mail', get_string('mail','admin'));
22 $temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_RAW));
23 $temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
24 $temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), ''));
25 $temp->add(new admin_setting_configtext('smtpmaxbulk', get_string('smtpmaxbulk', 'admin'), get_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
26 $temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_NOTAGS));
27 $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
28                                                                                                                                                           '01' => '01',
29                                                                                                                                                           '02' => '02',
30                                                                                                                                                           '03' => '03',
31                                                                                                                                                           '04' => '04',
32                                                                                                                                                           '05' => '05',
33                                                                                                                                                           '06' => '06',
34                                                                                                                                                           '07' => '07',
35                                                                                                                                                           '08' => '08',
36                                                                                                                                                           '09' => '09',
37                                                                                                                                                           '10' => '10',
38                                                                                                                                                           '11' => '11',
39                                                                                                                                                           '12' => '12',
40                                                                                                                                                           '13' => '13',
41                                                                                                                                                           '14' => '14',
42                                                                                                                                                           '15' => '15',
43                                                                                                                                                           '16' => '16',
44                                                                                                                                                           '17' => '17',
45                                                                                                                                                           '18' => '18',
46                                                                                                                                                           '19' => '19',
47                                                                                                                                                           '20' => '20',
48                                                                                                                                                           '21' => '21',
49                                                                                                                                                           '22' => '22',
50                                                                                                                                                           '23' => '23')));
51 $charsets = get_list_of_charsets();
52 unset($charsets['UTF-8']); // not needed here
53 $options = array();
54 $options['0'] = 'UTF-8';
55 $options = array_merge($options, $charsets);
56 $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '0', $options));
57 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
58 $options = array('LF'=>'LF', 'CRLF'=>'CRLF');
59 $temp->add(new admin_setting_configselect('mailnewline', get_string('mailnewline', 'admin'), get_string('configmailnewline','admin'), 'LF', $options));
60 if (isloggedin()) {
61     global $USER;
62     $primaryadminemail = $USER->email;
63     $primaryadminname  = fullname($USER, true);
65 } else {
66     // no defaults during installation - admin user must be created first
67     $primaryadminemail = NULL;
68     $primaryadminname  = NULL;
69 }
70 $temp->add(new admin_setting_configtext('supportname', get_string('supportname', 'admin'), get_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
71 $temp->add(new admin_setting_configtext('supportemail', get_string('supportemail', 'admin'), get_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
72 $temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', 'admin'), get_string('configsupportpage', 'admin'), '', PARAM_URL));
73 $ADMIN->add('server', $temp);
76 // Jabber settingpage
77 $temp = new admin_settingpage('jabber', get_string('jabber', 'admin'));
78 $temp->add(new admin_setting_configtext('jabberhost', get_string('jabberhost', 'admin'), get_string('configjabberhost', 'admin'), '', PARAM_RAW));
79 $temp->add(new admin_setting_configtext('jabberserver', get_string('jabberserver', 'admin'), get_string('configjabberserver', 'admin'), '', PARAM_RAW));
80 $temp->add(new admin_setting_configtext('jabberusername', get_string('jabberusername', 'admin'), get_string('configjabberusername', 'admin'), '', PARAM_RAW));
81 $temp->add(new admin_setting_configpasswordunmask('jabberpassword', get_string('jabberpassword', 'admin'), get_string('configjabberpassword', 'admin'), ''));
82 $temp->add(new admin_setting_configtext('jabberport', get_string('jabberport', 'admin'), get_string('configjabberport', 'admin'), 5222, PARAM_INT));
83 $ADMIN->add('server', $temp);
87 // "sessionhandling" settingpage
88 $temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin'));
89 $temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 1));
90 $temp->add(new admin_setting_configselect('sessiontimeout', get_string('sessiontimeout', 'admin'), get_string('configsessiontimeout', 'admin'), 7200, array(14400 => get_string('numhours', '', 4),
91                                                                                                                                                       10800 => get_string('numhours', '', 3),
92                                                                                                                                                       7200 => get_string('numhours', '', 2),
93                                                                                                                                                       5400 => get_string('numhours', '', '1.5'),
94                                                                                                                                                       3600 => get_string('numminutes', '', 60),
95                                                                                                                                                       2700 => get_string('numminutes', '', 45),
96                                                                                                                                                       1800 => get_string('numminutes', '', 30),
97                                                                                                                                                       900 => get_string('numminutes', '', 15),
98                                                                                                                                                       300 => get_string('numminutes', '', 5))));
99 $temp->add(new admin_setting_configtext('sessioncookie', get_string('sessioncookie', 'admin'), get_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
100 $temp->add(new admin_setting_configtext('sessioncookiepath', get_string('sessioncookiepath', 'admin'), get_string('configsessioncookiepath', 'admin'), '/', PARAM_LOCALURL));
101 $temp->add(new admin_setting_configtext('sessioncookiedomain', get_string('sessioncookiedomain', 'admin'), get_string('configsessioncookiedomain', 'admin'), '', PARAM_TEXT, 50));
102 $ADMIN->add('server', $temp);
105 // "stats" settingpage
106 $temp = new admin_settingpage('stats', get_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
107 $temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirstrun', 'admin'), get_string('configstatsfirstrun', 'admin'), 'none', array('none' => get_string('none'),
108                                                                                                                                                            60*60*24*7 => get_string('numweeks','moodle',1),
109                                                                                                                                                            60*60*24*14 => get_string('numweeks','moodle',2),
110                                                                                                                                                            60*60*24*21 => get_string('numweeks','moodle',3),
111                                                                                                                                                            60*60*24*28 => get_string('nummonths','moodle',1),
112                                                                                                                                                            60*60*24*56 => get_string('nummonths','moodle',2),
113                                                                                                                                                            60*60*24*84 => get_string('nummonths','moodle',3),
114                                                                                                                                                            60*60*24*112 => get_string('nummonths','moodle',4),
115                                                                                                                                                            60*60*24*140 => get_string('nummonths','moodle',5),
116                                                                                                                                                            60*60*24*168 => get_string('nummonths','moodle',6),
117                                                                                                                                                            'all' => get_string('all') )));
118 $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime3', 'admin'), 0, array(0 => get_string('untilcomplete'),
119                                                                                                                                                             60*30 => '10 '.get_string('minutes'),
120                                                                                                                                                             60*30 => '30 '.get_string('minutes'),
121                                                                                                                                                             60*60 => '1 '.get_string('hour'),
122                                                                                                                                                             60*60*2 => '2 '.get_string('hours'),
123                                                                                                                                                             60*60*3 => '3 '.get_string('hours'),
124                                                                                                                                                             60*60*4 => '4 '.get_string('hours'),
125                                                                                                                                                             60*60*5 => '5 '.get_string('hours'),
126                                                                                                                                                             60*60*6 => '6 '.get_string('hours'),
127                                                                                                                                                             60*60*7 => '7 '.get_string('hours'),
128                                                                                                                                                             60*60*8 => '8 '.get_string('hours') )));
129 $temp->add(new admin_setting_configtext('statsruntimedays', get_string('statsruntimedays', 'admin'), get_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
130 $temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
131 $temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
132 $ADMIN->add('server', $temp);
135 // "http" settingpage
136 $temp = new admin_settingpage('http', get_string('http', 'admin'));
137 $temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT));
138 $temp->add(new admin_setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
139 $temp->add(new admin_setting_heading('reverseproxy', get_string('reverseproxy', 'admin'), '', ''));
140 $options = array(
141     0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
142     GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
143     GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
144     GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
145 $temp->add(new admin_setting_configselect('getremoteaddrconf', get_string('getremoteaddrconf', 'admin'), get_string('configgetremoteaddrconf', 'admin'), 0, $options));
146 $temp->add(new admin_setting_heading('webproxy', get_string('webproxy', 'admin'), get_string('webproxyinfo', 'admin')));
147 $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
148 $temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
149 $options = array('HTTP'=>'HTTP');
150 if (defined('CURLPROXY_SOCKS5')) {
151     $options['SOCKS5'] = 'SOCKS5';
153 $temp->add(new admin_setting_configselect('proxytype', get_string('proxytype', 'admin'), get_string('configproxytype','admin'), 'HTTP', $options));
154 $temp->add(new admin_setting_configtext('proxyuser', get_string('proxyuser', 'admin'), get_string('configproxyuser', 'admin'), ''));
155 $temp->add(new admin_setting_configpasswordunmask('proxypassword', get_string('proxypassword', 'admin'), get_string('configproxypassword', 'admin'), ''));
156 $temp->add(new admin_setting_configtext('proxybypass', get_string('proxybypass', 'admin'), get_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
157 $ADMIN->add('server', $temp);
159 $temp = new admin_settingpage('maintenancemode', get_string('sitemaintenancemode', 'admin'));
160 $options = array(0=>get_string('disable'), 1=>get_string('enable'));
161 $temp->add(new admin_setting_configselect('maintenance_enabled', get_string('sitemaintenancemode', 'admin'),
162                                           get_string('helpsitemaintenance', 'admin'), 0, $options));
163 $temp->add(new admin_setting_confightmleditor('maintenance_message', get_string('optionalmaintenancemessage', 'admin'),
164                                               '', ''));
165 $ADMIN->add('server', $temp);
167 $temp = new admin_settingpage('cleanup', get_string('cleanup', 'admin'));
168 $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('deleteunconfirmed', 'admin'), get_string('configdeleteunconfirmed', 'admin'), 168, array(0 => get_string('never'),
169                                                                                                                                                                     168 => get_string('numdays', '', 7),
170                                                                                                                                                                     144 => get_string('numdays', '', 6),
171                                                                                                                                                                     120 => get_string('numdays', '', 5),
172                                                                                                                                                                     96 => get_string('numdays', '', 4),
173                                                                                                                                                                     72 => get_string('numdays', '', 3),
174                                                                                                                                                                     48 => get_string('numdays', '', 2),
175                                                                                                                                                                     24 => get_string('numdays', '', 1),
176                                                                                                                                                                     12 => get_string('numhours', '', 12),
177                                                                                                                                                                     6 => get_string('numhours', '', 6),
178                                                                                                                                                                     1 => get_string('numhours', '', 1))));
180 $temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('deleteincompleteusers', 'admin'), get_string('configdeleteincompleteusers', 'admin'), 0, array(0 => get_string('never'),
181                                                                                                                                                                     168 => get_string('numdays', '', 7),
182                                                                                                                                                                     144 => get_string('numdays', '', 6),
183                                                                                                                                                                     120 => get_string('numdays', '', 5),
184                                                                                                                                                                     96 => get_string('numdays', '', 4),
185                                                                                                                                                                     72 => get_string('numdays', '', 3),
186                                                                                                                                                                     48 => get_string('numdays', '', 2),
187                                                                                                                                                                     24 => get_string('numdays', '', 1))));
189 $temp->add(new admin_setting_configcheckbox('logguests', get_string('logguests', 'admin'),
190                                             get_string('logguests_help', 'admin'), 1));
191 $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
192                                                                                                                                                 1000 => get_string('numdays', '', 1000),
193                                                                                                                                                 365 => get_string('numdays', '', 365),
194                                                                                                                                                 180 => get_string('numdays', '', 180),
195                                                                                                                                                 150 => get_string('numdays', '', 150),
196                                                                                                                                                 120 => get_string('numdays', '', 120),
197                                                                                                                                                 90 => get_string('numdays', '', 90),
198                                                                                                                                                 60 => get_string('numdays', '', 60),
199                                                                                                                                                 35 => get_string('numdays', '', 35),
200                                                                                                                                                 10 => get_string('numdays', '', 10),
201                                                                                                                                                 5 => get_string('numdays', '', 5),
202                                                                                                                                                 2 => get_string('numdays', '', 2))));
205 $temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
206                                             get_string('disablegradehistory_help', 'grades'), 0));
208 $temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
209                                           get_string('gradehistorylifetime_help', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
210                                                                                                    1000 => get_string('numdays', '', 1000),
211                                                                                                     365 => get_string('numdays', '', 365),
212                                                                                                     180 => get_string('numdays', '', 180),
213                                                                                                     150 => get_string('numdays', '', 150),
214                                                                                                     120 => get_string('numdays', '', 120),
215                                                                                                      90 => get_string('numdays', '', 90),
216                                                                                                      60 => get_string('numdays', '', 60),
217                                                                                                      30 => get_string('numdays', '', 30))));
219 $ADMIN->add('server', $temp);
223 $ADMIN->add('server', new admin_externalpage('environment', get_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
224 $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
227 // "performance" settingpage
228 $temp = new admin_settingpage('performance', get_string('performance', 'admin'));
230 $temp->add(new admin_setting_configselect('extramemorylimit', get_string('extramemorylimit', 'admin'),
231                                           get_string('configextramemorylimit', 'admin'), '512M',
232                                           // if this option is set to 0, default 128M will be used
233                                           array( '64M' => '64M',
234                                                  '128M' => '128M',
235                                                  '256M' => '256M',
236                                                  '512M' => '512M',
237                                                  '1024M' => '1024M'
238                                              )));
239 $temp->add(new admin_setting_configtext('curlcache', get_string('curlcache', 'admin'),
240                                         get_string('configcurlcache', 'admin'), 120, PARAM_INT));
242 /* //TODO: we need to fix code instead of relying on slow rcache, enable this once we have some code that is actually using it
243 $temp->add(new admin_setting_special_selectsetup('cachetype', get_string('cachetype', 'admin'),
244                                           get_string('configcachetype', 'admin'), '',
245                                           array( '' => get_string('none'),
246                                                  'internal' => 'internal',
247                                                  'memcached' => 'memcached',
248                                                  'eaccelerator' => 'eaccelerator')));
249 // NOTE: $CFG->rcache is forced to bool in lib/setup.php
250 $temp->add(new admin_setting_special_selectsetup('rcache', get_string('rcache', 'admin'),
251                                           get_string('configrcache', 'admin'), 0,
252                                           array( '0' => get_string('no'),
253                                                  '1' => get_string('yes'))));
254 $temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
255                                         get_string('configrcachettl', 'admin'), 10));
256 $temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
257                                         get_string('configintcachemax', 'admin'), 10));
258 $temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
259                                         get_string('configmemcachedhosts', 'admin'), ''));
260 $temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
261                                           get_string('configmemcachedpconn', 'admin'), 0,
262                                           array( '0' => get_string('no'),
263                                                  '1' => get_string('yes'))));
264 */
265 $ADMIN->add('server', $temp);
268 $ADMIN->add('server', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
270 } // end of speedup