MDL-11515:
[moodle-linuxchix.git] / admin / settings / server.php
blobc095de24edbedd103e40d9da938bc3cfaec38d27
1 <?php // $Id$
3 // This file defines settingpages and externalpages under the "server" category
5 // "systempaths" settingpage
6 $temp = new admin_settingpage('systempaths', get_string('systempaths','admin'));
7 $temp->add(new admin_setting_configselect('gdversion', get_string('gdversion','admin'), get_string('configgdversion', 'admin'), check_gd_version(), array('0' => get_string('gdnot'),
8 '1' => get_string('gd1'),
9 '2' => get_string('gd2'))));
10 $temp->add(new admin_setting_configtext('zip', get_string('pathtozip','admin'), get_string('configzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
11 $temp->add(new admin_setting_configtext('unzip', get_string('pathtounzip','admin'), get_string('configunzip', 'admin'), '', PARAM_RAW)); // TODO: add path validation
12 $temp->add(new admin_setting_configtext('pathtodu', get_string('pathtodu', 'admin'), get_string('configpathtodu', 'admin'), '', PARAM_RAW)); // TODO: add path validation
13 $temp->add(new admin_setting_configtext('aspellpath', get_string('aspellpath', 'admin'), get_string('edhelpaspellpath'), '', PARAM_RAW)); // TODO: add path validation
14 $ADMIN->add('server', $temp, 0);
18 // "email" settingpage
19 $temp = new admin_settingpage('mail', get_string('mail','admin'));
20 $temp->add(new admin_setting_configtext('smtphosts', get_string('smtphosts', 'admin'), get_string('configsmtphosts', 'admin'), '', PARAM_HOST));
21 $temp->add(new admin_setting_configtext('smtpuser', get_string('smtpuser', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
22 $temp->add(new admin_setting_configpasswordunmask('smtppass', get_string('smtppass', 'admin'), get_string('configsmtpuser', 'admin'), '', PARAM_RAW));
23 $temp->add(new admin_setting_configtext('noreplyaddress', get_string('noreplyaddress', 'admin'), get_string('confignoreplyaddress', 'admin'), 'noreply@' . $_SERVER['HTTP_HOST'], PARAM_NOTAGS));
24 $temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
25 $temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
26 $temp->add(new admin_setting_configselect('digestmailtime', get_string('digestmailtime', 'admin'), get_string('configdigestmailtime', 'admin'), 17, array('00' => '00',
27 '01' => '01',
28 '02' => '02',
29 '03' => '03',
30 '04' => '04',
31 '05' => '05',
32 '06' => '06',
33 '07' => '07',
34 '08' => '08',
35 '09' => '09',
36 '10' => '10',
37 '11' => '11',
38 '12' => '12',
39 '13' => '13',
40 '14' => '14',
41 '15' => '15',
42 '16' => '16',
43 '17' => '17',
44 '18' => '18',
45 '19' => '19',
46 '20' => '20',
47 '21' => '21',
48 '22' => '22',
49 '23' => '23')));
50 $charsets = get_list_of_charsets();
51 unset($charsets['UTF-8']); // not needed here
52 $options = array();
53 $options['0'] = get_string('none');
54 $options = array_merge($options, $charsets);
55 $temp->add(new admin_setting_configselect('sitemailcharset', get_string('sitemailcharset', 'admin'), get_string('configsitemailcharset','admin'), '', $options));
56 $temp->add(new admin_setting_configcheckbox('allowusermailcharset', get_string('allowusermailcharset', 'admin'), get_string('configallowusermailcharset', 'admin'), 0));
57 if (isloggedin()) {
58 global $USER;
59 $primaryadminemail = $USER->email;
60 $primaryadminname = fullname($USER, true);
62 } else {
63 // no defaults during installation - admin user must be created first
64 $primaryadminemail = NULL;
65 $primaryadminname = NULL;
67 $temp->add(new admin_setting_configtext('supportname', get_string('supportname', 'admin'), get_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
68 $temp->add(new admin_setting_configtext('supportemail', get_string('supportemail', 'admin'), get_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
69 $temp->add(new admin_setting_configtext('supportpage', get_string('supportpage', 'admin'), get_string('configsupportpage', 'admin'), '', PARAM_URL));
70 $ADMIN->add('server', $temp, 100);
74 // "sessionhandling" settingpage
75 $temp = new admin_settingpage('sessionhandling', get_string('sessionhandling', 'admin'));
76 $temp->add(new admin_setting_configcheckbox('dbsessions', get_string('dbsessions', 'admin'), get_string('configdbsessions', 'admin'), 0));
77 $temp->add(new admin_setting_configselect('sessiontimeout', get_string('sessiontimeout', 'admin'), get_string('configsessiontimeout', 'admin'), 7200, array(14400 => get_string('numhours', '', 4),
78 10800 => get_string('numhours', '', 3),
79 7200 => get_string('numhours', '', 2),
80 5400 => get_string('numhours', '', '1.5'),
81 3600 => get_string('numminutes', '', 60),
82 2700 => get_string('numminutes', '', 45),
83 1800 => get_string('numminutes', '', 30),
84 900 => get_string('numminutes', '', 15),
85 300 => get_string('numminutes', '', 5))));
86 $temp->add(new admin_setting_configtext('sessioncookie', get_string('sessioncookie', 'admin'), get_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
87 $temp->add(new admin_setting_configtext('sessioncookiepath', get_string('sessioncookiepath', 'admin'), get_string('configsessioncookiepath', 'admin'), '/', PARAM_LOCALURL));
88 $ADMIN->add('server', $temp, 50);
92 // "rss" settingpage
93 $temp = new admin_settingpage('rss', get_string('rss'));
94 $temp->add(new admin_setting_configcheckbox('enablerssfeeds', get_string('enablerssfeeds', 'admin'), get_string('configenablerssfeeds', 'admin'), 0));
95 $ADMIN->add('server', $temp);
98 // "debugging" settingpage
99 $temp = new admin_settingpage('debugging', get_string('debugging', 'admin'));
100 $temp->add(new admin_setting_special_debug());
101 $temp->add(new admin_setting_special_debugdisplay());
102 $temp->add(new admin_setting_configcheckbox('xmlstrictheaders', get_string('xmlstrictheaders', 'admin'), get_string('configxmlstrictheaders', 'admin'), 0));
103 $temp->add(new admin_setting_configcheckbox('debugsmtp', get_string('debugsmtp', 'admin'), get_string('configdebugsmtp', 'admin'), 0));
104 $temp->add(new admin_setting_special_perfdebug());
105 $ADMIN->add('server', $temp);
108 // "stats" settingpage
109 $temp = new admin_settingpage('stats', get_string('stats'));
110 $temp->add(new admin_setting_configcheckbox('enablestats', get_string('enablestats', 'admin'), get_string('configenablestats', 'admin'), 0));
111 $temp->add(new admin_setting_configselect('statsfirstrun', get_string('statsfirstrun', 'admin'), get_string('configstatsfirstrun', 'admin'), 'none', array('none' => get_string('none'),
112 60*60*24*7 => get_string('numweeks','moodle',1),
113 60*60*24*14 => get_string('numweeks','moodle',2),
114 60*60*24*21 => get_string('numweeks','moodle',3),
115 60*60*24*28 => get_string('nummonths','moodle',1),
116 60*60*24*56 => get_string('nummonths','moodle',2),
117 60*60*24*84 => get_string('nummonths','moodle',3),
118 60*60*24*112 => get_string('nummonths','moodle',4),
119 60*60*24*140 => get_string('nummonths','moodle',5),
120 60*60*24*168 => get_string('nummonths','moodle',6),
121 'all' => get_string('all') )));
122 $temp->add(new admin_setting_configselect('statsmaxruntime', get_string('statsmaxruntime', 'admin'), get_string('configstatsmaxruntime', 'admin'), 0, array(0 => get_string('untilcomplete'),
123 60*60 => '1 '.get_string('hour'),
124 60*60*2 => '2 '.get_string('hours'),
125 60*60*3 => '3 '.get_string('hours'),
126 60*60*4 => '4 '.get_string('hours'),
127 60*60*5 => '5 '.get_string('hours'),
128 60*60*6 => '6 '.get_string('hours'),
129 60*60*7 => '7 '.get_string('hours'),
130 60*60*8 => '8 '.get_string('hours') )));
131 $temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', get_string('statsruntimestart', 'admin'), get_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
132 $temp->add(new admin_setting_configtext('statsuserthreshold', get_string('statsuserthreshold', 'admin'), get_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
133 $ADMIN->add('server', $temp);
136 // "http" settingpage
137 $temp = new admin_settingpage('http', get_string('http', 'admin'));
138 $temp->add(new admin_setting_configtext('framename', get_string('framename', 'admin'), get_string('configframename', 'admin'), '_top', PARAM_ALPHAEXT));
139 $temp->add(new admin_Setting_configcheckbox('slasharguments', get_string('slasharguments', 'admin'), get_string('configslasharguments', 'admin'), 1));
140 $temp->add(new admin_setting_configtext('proxyhost', get_string('proxyhost', 'admin'), get_string('configproxyhost', 'admin'), '', PARAM_HOST));
141 $temp->add(new admin_setting_configtext('proxyport', get_string('proxyport', 'admin'), get_string('configproxyport', 'admin'), 0, PARAM_INT));
142 $ADMIN->add('server', $temp);
144 $ADMIN->add('server', new admin_externalpage('maintenancemode', get_string('sitemaintenancemode', 'admin'), "$CFG->wwwroot/$CFG->admin/maintenance.php"));
147 $temp = new admin_settingpage('cleanup', get_string('cleanup', 'admin'));
148 $temp->add(new admin_setting_configselect('longtimenosee', get_string('longtimenosee', 'admin'), get_string('configlongtimenosee', 'admin'), 120, array(0 => get_string('never'),
149 1000 => get_string('numdays', '', 1000),
150 365 => get_string('numdays', '', 365),
151 180 => get_string('numdays', '', 180),
152 150 => get_string('numdays', '', 150),
153 120 => get_string('numdays', '', 120),
154 90 => get_string('numdays', '', 90),
155 60 => get_string('numdays', '', 60),
156 30 => get_string('numdays', '', 30),
157 21 => get_string('numdays', '', 21),
158 14 => get_string('numdays', '', 14),
159 7 => get_string('numdays', '', 7) )));
160 $temp->add(new admin_setting_configselect('deleteunconfirmed', get_string('deleteunconfirmed', 'admin'), get_string('configdeleteunconfirmed', 'admin'), 168, array(0 => get_string('never'),
161 168 => get_string('numdays', '', 7),
162 144 => get_string('numdays', '', 6),
163 120 => get_string('numdays', '', 5),
164 96 => get_string('numdays', '', 4),
165 72 => get_string('numdays', '', 3),
166 48 => get_string('numdays', '', 2),
167 24 => get_string('numdays', '', 1),
168 12 => get_string('numhours', '', 12),
169 6 => get_string('numhours', '', 6),
170 1 => get_string('numhours', '', 1))));
172 $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
173 1000 => get_string('numdays', '', 1000),
174 365 => get_string('numdays', '', 365),
175 180 => get_string('numdays', '', 180),
176 150 => get_string('numdays', '', 150),
177 120 => get_string('numdays', '', 120),
178 90 => get_string('numdays', '', 90),
179 60 => get_string('numdays', '', 60),
180 30 => get_string('numdays', '', 30))));
182 $ADMIN->add('server', $temp);
186 $ADMIN->add('server', new admin_externalpage('environment', get_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
187 $ADMIN->add('server', new admin_externalpage('phpinfo', get_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
190 // "performance" settingpage
191 $temp = new admin_settingpage('performance', get_string('performance', 'admin'));
192 $temp->add(new admin_setting_configselect('cachetype', get_string('cachetype', 'admin'),
193 get_string('configcachetype', 'admin'), '',
194 array( '' => get_string('none'),
195 'internal' => 'internal',
196 'memcached' => 'memcached',
197 'eaccelerator' => 'eaccelerator')));
198 // NOTE: $CFG->rcache is forced to bool in lib/setup.php
199 $temp->add(new admin_setting_configselect('rcache', get_string('rcache', 'admin'),
200 get_string('configrcache', 'admin'), 0,
201 array( '0' => get_string('no'),
202 '1' => get_string('yes'))));
203 $temp->add(new admin_setting_configtext('rcachettl', get_string('rcachettl', 'admin'),
204 get_string('configrcachettl', 'admin'), 10));
205 $temp->add(new admin_setting_configtext('intcachemax', get_string('intcachemax', 'admin'),
206 get_string('configintcachemax', 'admin'), 10));
207 $temp->add(new admin_setting_configtext('memcachedhosts', get_string('memcachedhosts', 'admin'),
208 get_string('configmemcachedhosts', 'admin'), ''));
209 $temp->add(new admin_setting_configselect('memcachedpconn', get_string('memcachedpconn', 'admin'),
210 get_string('configmemcachedpconn', 'admin'), 0,
211 array( '0' => get_string('no'),
212 '1' => get_string('yes'))));
213 $ADMIN->add('server', $temp);
215 if (file_exists("$CFG->dirroot/$CFG->admin/mysql/frame.php")) {
216 $ADMIN->add('server', new admin_externalpage('database', get_string('managedatabase'), "$CFG->wwwroot/$CFG->admin/mysql/frame.php"));