commit | author | age
|
8896ab
|
1 |
<?php |
N |
2 |
|
|
3 |
/* |
|
4 |
Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh |
|
5 |
All rights reserved. |
|
6 |
|
|
7 |
Redistribution and use in source and binary forms, with or without modification, |
|
8 |
are permitted provided that the following conditions are met: |
|
9 |
|
|
10 |
* Redistributions of source code must retain the above copyright notice, |
|
11 |
this list of conditions and the following disclaimer. |
|
12 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
13 |
this list of conditions and the following disclaimer in the documentation |
|
14 |
and/or other materials provided with the distribution. |
|
15 |
* Neither the name of ISPConfig nor the names of its contributors |
|
16 |
may be used to endorse or promote products derived from this software without |
|
17 |
specific prior written permission. |
|
18 |
|
|
19 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
|
20 |
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
21 |
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
|
22 |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
|
23 |
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
24 |
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
25 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|
26 |
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
27 |
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
|
28 |
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
29 |
*/ |
|
30 |
|
|
31 |
/* |
|
32 |
ISPConfig 3 updater. |
b04e82
|
33 |
|
TB |
34 |
------------------------------------------------------------------------------------- |
|
35 |
- Interactive update |
|
36 |
------------------------------------------------------------------------------------- |
|
37 |
run: |
|
38 |
|
|
39 |
php update.php |
|
40 |
|
|
41 |
------------------------------------------------------------------------------------- |
|
42 |
- Noninteractive (autoupdate) mode |
|
43 |
------------------------------------------------------------------------------------- |
|
44 |
|
|
45 |
The autoupdate mode can read the updater questions from a .ini style file or from |
|
46 |
a php config file. Examples for both file types are in the docs folder. |
|
47 |
See autoinstall.ini.sample and autoinstall.conf_sample.php. |
|
48 |
|
|
49 |
run: |
|
50 |
|
|
51 |
php update.php --autoinstall=autoinstall.ini |
|
52 |
|
|
53 |
or |
|
54 |
|
|
55 |
php update.php --autoinstall=autoinstall.conf.php |
|
56 |
|
8896ab
|
57 |
*/ |
N |
58 |
|
|
59 |
error_reporting(E_ALL|E_STRICT); |
|
60 |
|
992797
|
61 |
define('INSTALLER_RUN', true); |
MC |
62 |
|
8896ab
|
63 |
//** The banner on the command line |
7fe908
|
64 |
echo "\n\n".str_repeat('-', 80)."\n"; |
8896ab
|
65 |
echo " _____ ___________ _____ __ _ ____ |
N |
66 |
|_ _/ ___| ___ \ / __ \ / _(_) /__ \ |
|
67 |
| | \ `--.| |_/ / | / \/ ___ _ __ | |_ _ __ _ _/ / |
|
68 |
| | `--. \ __/ | | / _ \| '_ \| _| |/ _` | |_ | |
|
69 |
_| |_/\__/ / | | \__/\ (_) | | | | | | | (_| | ___\ \ |
|
70 |
\___/\____/\_| \____/\___/|_| |_|_| |_|\__, | \____/ |
|
71 |
__/ | |
|
72 |
|___/ "; |
7fe908
|
73 |
echo "\n".str_repeat('-', 80)."\n"; |
8896ab
|
74 |
echo "\n\n>> Update \n\n"; |
N |
75 |
|
|
76 |
//** Include the library with the basic installer functions |
7fe908
|
77 |
require_once 'lib/install.lib.php'; |
8896ab
|
78 |
|
N |
79 |
//** Include the library with the basic updater functions |
7fe908
|
80 |
require_once 'lib/update.lib.php'; |
8896ab
|
81 |
|
N |
82 |
//** Include the base class of the installer class |
7fe908
|
83 |
require_once 'lib/installer_base.lib.php'; |
8896ab
|
84 |
|
N |
85 |
//** Ensure that current working directory is install directory |
|
86 |
$cur_dir = getcwd(); |
|
87 |
if(realpath(dirname(__FILE__)) != $cur_dir) die("Please run installation/update from _inside_ the install directory!\n"); |
|
88 |
|
|
89 |
//** Install logfile |
|
90 |
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log'); |
|
91 |
define('ISPC_INSTALL_ROOT', realpath(dirname(__FILE__).'/../')); |
|
92 |
|
ccbf14
|
93 |
//** Include the templating lib |
TB |
94 |
require_once 'lib/classes/tpl.inc.php'; |
|
95 |
|
8896ab
|
96 |
//** Check for ISPConfig 2.x versions |
N |
97 |
if(is_dir('/root/ispconfig') || is_dir('/home/admispconfig')) { |
|
98 |
die('This software cannot be installed on a server wich runs ISPConfig 2.x.'); |
|
99 |
} |
|
100 |
|
|
101 |
//** Get distribution identifier |
|
102 |
$dist = get_distname(); |
|
103 |
|
7fe908
|
104 |
include_once "/usr/local/ispconfig/server/lib/config.inc.php"; |
8896ab
|
105 |
$conf_old = $conf; |
N |
106 |
unset($conf); |
|
107 |
|
|
108 |
if($dist['id'] == '') die('Linux distribution or version not recognized.'); |
|
109 |
|
ebd0e9
|
110 |
//** Check the PHP Version |
TB |
111 |
if (version_compare(PHP_VERSION, '7.0.0') >= 0) { |
|
112 |
die('PHP 7 is not supported by ISPConfig 3.0.5. Plesae use ISPConfig version 3.1 instead.'); |
|
113 |
} |
|
114 |
|
bcd725
|
115 |
//** Include the autoinstaller configuration (for non-interactive setups) |
FT |
116 |
error_reporting(E_ALL ^ E_NOTICE); |
b04e82
|
117 |
|
TB |
118 |
//** Get commandline options |
|
119 |
$cmd_opt = getopt('', array('autoinstall::')); |
|
120 |
|
|
121 |
//** Load autoinstall file |
|
122 |
if(isset($cmd_opt['autoinstall']) && is_file($cmd_opt['autoinstall'])) { |
|
123 |
$path_parts = pathinfo($cmd_opt['autoinstall']); |
|
124 |
if($path_parts['extension'] == 'php') { |
|
125 |
include_once $cmd_opt['autoinstall']; |
|
126 |
} elseif($path_parts['extension'] == 'ini') { |
|
127 |
$tmp = ini_to_array(file_get_contents('autoinstall.ini')); |
c8509b
|
128 |
if(!is_array($tmp['install'])) $tmp['install'] = array(); |
MC |
129 |
if(!is_array($tmp['ssl_cert'])) $tmp['ssl_cert'] = array(); |
|
130 |
if(!is_array($tmp['expert'])) $tmp['expert'] = array(); |
|
131 |
if(!is_array($tmp['update'])) $tmp['update'] = array(); |
b04e82
|
132 |
$autoinstall = $tmp['install'] + $tmp['ssl_cert'] + $tmp['expert'] + $tmp['update']; |
TB |
133 |
unset($tmp); |
|
134 |
} |
|
135 |
unset($path_parts); |
|
136 |
define('AUTOINSTALL', true); |
|
137 |
} else { |
|
138 |
$autoinstall = array(); |
|
139 |
define('AUTOINSTALL', false); |
|
140 |
} |
bcd725
|
141 |
|
8896ab
|
142 |
//** Include the distribution-specific installer class library and configuration |
7fe908
|
143 |
if(is_file('dist/lib/'.$dist['baseid'].'.lib.php')) include_once 'dist/lib/'.$dist['baseid'].'.lib.php'; |
MC |
144 |
include_once 'dist/lib/'.$dist['id'].'.lib.php'; |
|
145 |
include_once 'dist/conf/'.$dist['id'].'.conf.php'; |
8896ab
|
146 |
|
N |
147 |
//** Get hostname |
|
148 |
exec('hostname -f', $tmp_out); |
|
149 |
$conf['hostname'] = $tmp_out[0]; |
|
150 |
unset($tmp_out); |
|
151 |
|
|
152 |
//** Set the mysql login information |
|
153 |
$conf["mysql"]["host"] = $conf_old["db_host"]; |
|
154 |
$conf["mysql"]["database"] = $conf_old["db_database"]; |
|
155 |
$conf['mysql']['charset'] = 'utf8'; |
|
156 |
$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"]; |
|
157 |
$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"]; |
|
158 |
$conf['language'] = $conf_old['language']; |
d6b361
|
159 |
$conf['theme'] = $conf_old['theme']; |
8896ab
|
160 |
if($conf['language'] == '{language}') $conf['language'] = 'en'; |
355efb
|
161 |
$conf['timezone'] = (isset($conf_old['timezone']))?$conf_old['timezone']:'UTC'; |
8cf78b
|
162 |
if($conf['timezone'] == '{timezone}' or trim($conf['timezone']) == '') $conf['timezone'] = 'UTC'; |
992797
|
163 |
$conf['language_file_import_enabled'] = (isset($conf_old['language_file_import_enabled']))?$conf_old['language_file_import_enabled']:true; |
8896ab
|
164 |
|
N |
165 |
if(isset($conf_old["dbmaster_host"])) $conf["mysql"]["master_host"] = $conf_old["dbmaster_host"]; |
|
166 |
if(isset($conf_old["dbmaster_database"])) $conf["mysql"]["master_database"] = $conf_old["dbmaster_database"]; |
|
167 |
if(isset($conf_old["dbmaster_user"])) $conf["mysql"]["master_ispconfig_user"] = $conf_old["dbmaster_user"]; |
|
168 |
if(isset($conf_old["dbmaster_password"])) $conf["mysql"]["master_ispconfig_password"] = $conf_old["dbmaster_password"]; |
|
169 |
|
|
170 |
//* Check if this is a master / slave setup |
|
171 |
if($conf["mysql"]["master_host"] != '' && $conf["mysql"]["host"] != $conf["mysql"]["master_host"]) { |
|
172 |
$conf['mysql']['master_slave_setup'] = 'y'; |
|
173 |
} |
|
174 |
|
|
175 |
// Resolve the IP address of the mysql hostname. |
|
176 |
if(!$conf['mysql']['ip'] = gethostbyname($conf['mysql']['host'])) die('Unable to resolve hostname'.$conf['mysql']['host']); |
|
177 |
|
|
178 |
$conf['server_id'] = intval($conf_old["server_id"]); |
|
179 |
$conf['ispconfig_log_priority'] = $conf_old["log_priority"]; |
|
180 |
|
|
181 |
$inst = new installer(); |
|
182 |
$inst->is_update = true; |
|
183 |
|
|
184 |
//** Detect the installed applications |
|
185 |
$inst->find_installed_apps(); |
|
186 |
|
8cf78b
|
187 |
echo "This application will update ISPConfig 3 on your server.\n\n"; |
T |
188 |
|
|
189 |
//* Make a backup before we start the update |
b04e82
|
190 |
$do_backup = $inst->simple_query('Shall the script create a ISPConfig backup in /var/backup/ now?', array('yes', 'no'), 'yes','do_backup'); |
bcd725
|
191 |
|
8cf78b
|
192 |
if($do_backup == 'yes') { |
7fe908
|
193 |
|
8cf78b
|
194 |
//* Create the backup directory |
cc6568
|
195 |
$backup_path = '/var/backup/ispconfig_'.@date('Y-m-d_H-i'); |
8cf78b
|
196 |
$conf['backup_path'] = $backup_path; |
T |
197 |
exec("mkdir -p $backup_path"); |
|
198 |
exec("chown root:root $backup_path"); |
|
199 |
exec("chmod 700 $backup_path"); |
7fe908
|
200 |
|
8cf78b
|
201 |
//* Do the backup |
T |
202 |
swriteln('Creating backup of "/usr/local/ispconfig" directory...'); |
7fe908
|
203 |
exec("tar pcfz $backup_path/ispconfig_software.tar.gz /usr/local/ispconfig 2> /dev/null", $out, $returnvar); |
8cf78b
|
204 |
if($returnvar != 0) die("Backup failed. We stop here...\n"); |
7fe908
|
205 |
|
8cf78b
|
206 |
swriteln('Creating backup of "/etc" directory...'); |
7fe908
|
207 |
exec("tar pcfz $backup_path/etc.tar.gz /etc 2> /dev/null", $out, $returnvar); |
8cf78b
|
208 |
if($returnvar != 0) die("Backup failed. We stop here...\n"); |
7fe908
|
209 |
|
8cf78b
|
210 |
exec("chown root:root $backup_path/*.tar.gz"); |
T |
211 |
exec("chmod 700 $backup_path/*.tar.gz"); |
|
212 |
} |
|
213 |
|
8896ab
|
214 |
|
N |
215 |
//** Initialize the MySQL server connection |
7fe908
|
216 |
include_once 'lib/mysql.lib.php'; |
8896ab
|
217 |
|
N |
218 |
//** Database update is a bit brute force and should be rebuild later ;) |
|
219 |
|
|
220 |
/* |
|
221 |
* Try to read the DB-admin settings |
|
222 |
*/ |
7fe908
|
223 |
$clientdb_host = ''; |
MC |
224 |
$clientdb_user = ''; |
|
225 |
$clientdb_password = ''; |
|
226 |
include_once "/usr/local/ispconfig/server/lib/mysql_clientdb.conf"; |
8896ab
|
227 |
$conf["mysql"]["admin_user"] = $clientdb_user; |
N |
228 |
$conf["mysql"]["admin_password"] = $clientdb_password; |
7fe908
|
229 |
$clientdb_host = ''; |
MC |
230 |
$clientdb_user = ''; |
|
231 |
$clientdb_password = ''; |
8896ab
|
232 |
|
edf806
|
233 |
//** Test mysql root connection |
T |
234 |
$finished = false; |
|
235 |
do { |
7fe908
|
236 |
if(@mysql_connect($conf["mysql"]["host"], $conf["mysql"]["admin_user"], $conf["mysql"]["admin_password"])) { |
edf806
|
237 |
$finished = true; |
T |
238 |
} else { |
|
239 |
swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); |
b04e82
|
240 |
$conf["mysql"]["admin_password"] = $inst->free_query('MySQL root password', $conf['mysql']['admin_password'],'mysql_root_password'); |
edf806
|
241 |
} |
T |
242 |
} while ($finished == false); |
|
243 |
unset($finished); |
8896ab
|
244 |
|
N |
245 |
/* |
7fe908
|
246 |
* Prepare the dump of the database |
8896ab
|
247 |
*/ |
N |
248 |
prepareDBDump(); |
|
249 |
|
|
250 |
//* initialize the database |
|
251 |
$inst->db = new db(); |
|
252 |
|
|
253 |
//* initialize the master DB, if we have a multiserver setup |
|
254 |
if($conf['mysql']['master_slave_setup'] == 'y') { |
7fe908
|
255 |
//** Get MySQL root credentials |
MC |
256 |
$finished = false; |
|
257 |
do { |
b04e82
|
258 |
$tmp_mysql_server_host = $inst->free_query('MySQL master server hostname', $conf['mysql']['master_host'],'mysql_master_hostname'); |
TB |
259 |
$tmp_mysql_server_admin_user = $inst->free_query('MySQL master server root username', $conf['mysql']['master_admin_user'],'mysql_master_root_user'); |
|
260 |
$tmp_mysql_server_admin_password = $inst->free_query('MySQL master server root password', $conf['mysql']['master_admin_password'],'mysql_master_root_password'); |
|
261 |
$tmp_mysql_server_database = $inst->free_query('MySQL master server database name', $conf['mysql']['master_database'],'mysql_master_database'); |
7fe908
|
262 |
|
MC |
263 |
//* Initialize the MySQL server connection |
|
264 |
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) { |
|
265 |
$conf['mysql']['master_host'] = $tmp_mysql_server_host; |
|
266 |
$conf['mysql']['master_admin_user'] = $tmp_mysql_server_admin_user; |
|
267 |
$conf['mysql']['master_admin_password'] = $tmp_mysql_server_admin_password; |
|
268 |
$conf['mysql']['master_database'] = $tmp_mysql_server_database; |
|
269 |
$finished = true; |
|
270 |
} else { |
|
271 |
swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error()); |
|
272 |
} |
|
273 |
} while ($finished == false); |
|
274 |
unset($finished); |
|
275 |
|
|
276 |
// initialize the connection to the master database |
|
277 |
$inst->dbmaster = new db(); |
|
278 |
if($inst->dbmaster->linkId) $inst->dbmaster->closeConn(); |
|
279 |
$inst->dbmaster->dbHost = $conf['mysql']["master_host"]; |
|
280 |
$inst->dbmaster->dbName = $conf['mysql']["master_database"]; |
|
281 |
$inst->dbmaster->dbUser = $conf['mysql']["master_admin_user"]; |
|
282 |
$inst->dbmaster->dbPass = $conf['mysql']["master_admin_password"]; |
8896ab
|
283 |
} else { |
N |
284 |
$inst->dbmaster = $inst->db; |
|
285 |
} |
|
286 |
|
|
287 |
/* |
|
288 |
* Check all tables |
|
289 |
*/ |
|
290 |
checkDbHealth(); |
|
291 |
|
|
292 |
/* |
|
293 |
* dump the new Database and reconfigure the server.ini |
|
294 |
*/ |
|
295 |
updateDbAndIni(); |
|
296 |
|
|
297 |
/* |
|
298 |
* Reconfigure the permisson if needed |
|
299 |
* (if this is done at client side, only this client is updated. |
|
300 |
* If this is done at server side, all clients are updated. |
|
301 |
*/ |
|
302 |
//if($conf_old['dbmaster_user'] != '' or $conf_old['dbmaster_host'] != '') { |
7fe908
|
303 |
//** Update master database rights |
b04e82
|
304 |
$reconfigure_master_database_rights_answer = $inst->simple_query('Reconfigure Permissions in master database?', array('yes', 'no'), 'no','reconfigure_permissions_in_master_database'); |
8896ab
|
305 |
|
7fe908
|
306 |
if($reconfigure_master_database_rights_answer == 'yes') { |
MC |
307 |
$inst->grant_master_database_rights(); |
|
308 |
} |
8896ab
|
309 |
//} |
N |
310 |
|
|
311 |
//** Shall the services be reconfigured during update |
b04e82
|
312 |
$reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes', 'no'), 'yes','reconfigure_services'); |
8896ab
|
313 |
|
N |
314 |
if($reconfigure_services_answer == 'yes') { |
7fe908
|
315 |
|
8896ab
|
316 |
if($conf['services']['mail']) { |
N |
317 |
//** Configure postfix |
|
318 |
swriteln('Configuring Postfix'); |
|
319 |
$inst->configure_postfix('dont-create-certs'); |
7fe908
|
320 |
|
8896ab
|
321 |
//** Configure mailman |
f9d95c
|
322 |
if($conf['mailman']['installed'] == true) { |
CS |
323 |
swriteln('Configuring Mailman'); |
|
324 |
$inst->configure_mailman('update'); |
|
325 |
} |
7fe908
|
326 |
|
8896ab
|
327 |
//* Configure Jailkit |
N |
328 |
swriteln('Configuring Jailkit'); |
|
329 |
$inst->configure_jailkit(); |
|
330 |
|
|
331 |
if($conf['dovecot']['installed'] == true) { |
|
332 |
//* Configure dovecot |
|
333 |
swriteln('Configuring Dovecot'); |
|
334 |
$inst->configure_dovecot(); |
|
335 |
} else { |
|
336 |
//** Configure saslauthd |
|
337 |
swriteln('Configuring SASL'); |
|
338 |
$inst->configure_saslauthd(); |
7fe908
|
339 |
|
8896ab
|
340 |
//** Configure PAM |
N |
341 |
swriteln('Configuring PAM'); |
|
342 |
$inst->configure_pam(); |
7fe908
|
343 |
|
8896ab
|
344 |
//* Configure courier |
N |
345 |
swriteln('Configuring Courier'); |
|
346 |
$inst->configure_courier(); |
|
347 |
} |
|
348 |
|
|
349 |
//** Configure Spamasassin |
|
350 |
swriteln('Configuring Spamassassin'); |
|
351 |
$inst->configure_spamassassin(); |
|
352 |
|
|
353 |
//** Configure Amavis |
|
354 |
swriteln('Configuring Amavisd'); |
|
355 |
$inst->configure_amavis(); |
|
356 |
|
|
357 |
//** Configure Getmail |
|
358 |
swriteln('Configuring Getmail'); |
|
359 |
$inst->configure_getmail(); |
|
360 |
} |
7fe908
|
361 |
|
8896ab
|
362 |
if($conf['services']['web'] && $conf['pureftpd']['installed'] == true) { |
N |
363 |
//** Configure Pureftpd |
|
364 |
swriteln('Configuring Pureftpd'); |
|
365 |
$inst->configure_pureftpd(); |
|
366 |
} |
7fe908
|
367 |
|
8896ab
|
368 |
if($conf['services']['dns']) { |
N |
369 |
//* Configure DNS |
|
370 |
if($conf['powerdns']['installed'] == true) { |
|
371 |
swriteln('Configuring PowerDNS'); |
|
372 |
$inst->configure_powerdns(); |
|
373 |
} elseif($conf['bind']['installed'] == true) { |
|
374 |
swriteln('Configuring BIND'); |
|
375 |
$inst->configure_bind(); |
|
376 |
} else { |
|
377 |
swriteln('Configuring MyDNS'); |
|
378 |
$inst->configure_mydns(); |
|
379 |
} |
|
380 |
} |
7fe908
|
381 |
|
8896ab
|
382 |
if($conf['services']['web']) { |
4ffb51
|
383 |
if($conf['webserver']['server_type'] == 'apache'){ |
F |
384 |
//** Configure Apache |
|
385 |
swriteln('Configuring Apache'); |
|
386 |
$inst->configure_apache(); |
7fe908
|
387 |
|
4ffb51
|
388 |
//** Configure vlogger |
F |
389 |
swriteln('Configuring vlogger'); |
|
390 |
$inst->configure_vlogger(); |
|
391 |
} else { |
|
392 |
//** Configure nginx |
|
393 |
swriteln('Configuring nginx'); |
|
394 |
$inst->configure_nginx(); |
|
395 |
} |
7fe908
|
396 |
|
8896ab
|
397 |
//** Configure apps vhost |
N |
398 |
swriteln('Configuring Apps vhost'); |
|
399 |
$inst->configure_apps_vhost(); |
|
400 |
} |
|
401 |
|
|
402 |
|
|
403 |
//* Configure DBServer |
|
404 |
swriteln('Configuring Database'); |
|
405 |
$inst->configure_dbserver(); |
|
406 |
|
7fe908
|
407 |
|
8896ab
|
408 |
if($conf['services']['firewall']) { |
992797
|
409 |
if($conf['bastille']['installed'] == true) { |
8896ab
|
410 |
//* Configure Bastille Firewall |
N |
411 |
swriteln('Configuring Bastille Firewall'); |
992797
|
412 |
$inst->configure_firewall(); |
8896ab
|
413 |
} |
N |
414 |
} |
7fe908
|
415 |
|
4ffb51
|
416 |
/* |
8896ab
|
417 |
if($conf['squid']['installed'] == true) { |
N |
418 |
swriteln('Configuring Squid'); |
|
419 |
$inst->configure_squid(); |
|
420 |
} else if($conf['nginx']['installed'] == true) { |
|
421 |
swriteln('Configuring Nginx'); |
|
422 |
$inst->configure_nginx(); |
|
423 |
} |
4ffb51
|
424 |
*/ |
8896ab
|
425 |
} |
N |
426 |
|
|
427 |
//** Configure ISPConfig |
|
428 |
swriteln('Updating ISPConfig'); |
6ba4fa
|
429 |
if($conf['apache']['installed'] == true){ |
FT |
430 |
if(!is_file($conf['apache']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
|
431 |
} |
|
432 |
if($conf['nginx']['installed'] == true){ |
|
433 |
if(!is_file($conf['nginx']['vhost_conf_dir'].'/ispconfig.vhost')) $inst->install_ispconfig_interface = false; |
|
434 |
} |
8896ab
|
435 |
|
b67344
|
436 |
if ($conf['services']['web'] && $inst->install_ispconfig_interface) { |
8896ab
|
437 |
//** Customise the port ISPConfig runs on |
N |
438 |
$ispconfig_port_number = get_ispconfig_port_number(); |
bcd725
|
439 |
if($autoupdate['ispconfig_port'] == 'default') $autoupdate['ispconfig_port'] = $ispconfig_port_number; |
4ffb51
|
440 |
if($conf['webserver']['server_type'] == 'nginx'){ |
b04e82
|
441 |
$conf['nginx']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number,'ispconfig_port'); |
4ffb51
|
442 |
} else { |
b04e82
|
443 |
$conf['apache']['vhost_port'] = $inst->free_query('ISPConfig Port', $ispconfig_port_number,'ispconfig_port'); |
4ffb51
|
444 |
} |
7fe908
|
445 |
|
MC |
446 |
|
8896ab
|
447 |
// $ispconfig_ssl_default = (is_ispconfig_ssl_enabled() == true)?'y':'n'; |
b04e82
|
448 |
if(strtolower($inst->simple_query('Create new ISPConfig SSL certificate', array('yes', 'no'), 'no','create_new_ispconfig_ssl_cert')) == 'yes') { |
8896ab
|
449 |
$inst->make_ispconfig_ssl_cert(); |
N |
450 |
} |
|
451 |
} |
|
452 |
|
|
453 |
$inst->install_ispconfig(); |
|
454 |
|
5b3f25
|
455 |
// Cleanup |
TB |
456 |
$inst->cleanup_ispconfig(); |
|
457 |
|
8896ab
|
458 |
//** Configure Crontab |
b04e82
|
459 |
$update_crontab_answer = $inst->simple_query('Reconfigure Crontab?', array('yes', 'no'), 'yes','reconfigure_crontab'); |
8896ab
|
460 |
if($update_crontab_answer == 'yes') { |
N |
461 |
swriteln('Updating Crontab'); |
|
462 |
$inst->install_crontab(); |
|
463 |
} |
|
464 |
|
|
465 |
//** Restart services: |
|
466 |
if($reconfigure_services_answer == 'yes') { |
|
467 |
swriteln('Restarting services ...'); |
1e67c1
|
468 |
if($conf['mysql']['installed'] == true && $conf['mysql']['init_script'] != '') system($inst->getinitcommand($conf['mysql']['init_script'], 'restart').' >/dev/null 2>&1'); |
8896ab
|
469 |
if($conf['services']['mail']) { |
3327ed
|
470 |
if($conf['postfix']['installed'] == true && $conf['postfix']['init_script'] != '') system($inst->getinitcommand($conf['postfix']['init_script'], 'restart')); |
FT |
471 |
if($conf['saslauthd']['installed'] == true && $conf['saslauthd']['init_script'] != '') system($inst->getinitcommand($conf['saslauthd']['init_script'], 'restart')); |
|
472 |
if($conf['amavis']['installed'] == true && $conf['amavis']['init_script'] != '') system($inst->getinitcommand($conf['amavis']['init_script'], 'restart')); |
|
473 |
if($conf['clamav']['installed'] == true && $conf['clamav']['init_script'] != '') system($inst->getinitcommand($conf['clamav']['init_script'], 'restart')); |
|
474 |
if($conf['courier']['installed'] == true){ |
|
475 |
if($conf['courier']['courier-authdaemon'] != '') system($inst->getinitcommand($conf['courier']['courier-authdaemon'], 'restart')); |
|
476 |
if($conf['courier']['courier-imap'] != '') system($inst->getinitcommand($conf['courier']['courier-imap'], 'restart')); |
|
477 |
if($conf['courier']['courier-imap-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-imap-ssl'], 'restart')); |
|
478 |
if($conf['courier']['courier-pop'] != '') system($inst->getinitcommand($conf['courier']['courier-pop'], 'restart')); |
|
479 |
if($conf['courier']['courier-pop-ssl'] != '') system($inst->getinitcommand($conf['courier']['courier-pop-ssl'], 'restart')); |
|
480 |
} |
|
481 |
if($conf['dovecot']['installed'] == true && $conf['dovecot']['init_script'] != '') system($inst->getinitcommand($conf['dovecot']['init_script'], 'restart')); |
|
482 |
if($conf['mailman']['installed'] == true && $conf['mailman']['init_script'] != '') system('nohup '.$inst->getinitcommand($conf['mailman']['init_script'], 'restart').' >/dev/null 2>&1 &'); |
8896ab
|
483 |
} |
N |
484 |
if($conf['services']['web']) { |
33bcd0
|
485 |
if($conf['webserver']['server_type'] == 'apache' && $conf['apache']['init_script'] != '') system($inst->getinitcommand($conf['apache']['init_script'], 'restart')); |
4ffb51
|
486 |
//* Reload is enough for nginx |
F |
487 |
if($conf['webserver']['server_type'] == 'nginx'){ |
33bcd0
|
488 |
if($conf['nginx']['php_fpm_init_script'] != '') system($inst->getinitcommand($conf['nginx']['php_fpm_init_script'], 'reload')); |
FT |
489 |
if($conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'reload')); |
4ffb51
|
490 |
} |
3327ed
|
491 |
if($conf['pureftpd']['installed'] == true && $conf['pureftpd']['init_script'] != '') system($inst->getinitcommand($conf['pureftpd']['init_script'], 'restart')); |
8896ab
|
492 |
} |
N |
493 |
if($conf['services']['dns']) { |
33bcd0
|
494 |
if($conf['mydns']['installed'] == true && $conf['mydns']['init_script'] != '') system($inst->getinitcommand($conf['mydns']['init_script'], 'restart').' &> /dev/null'); |
FT |
495 |
if($conf['powerdns']['installed'] == true && $conf['powerdns']['init_script'] != '') system($inst->getinitcommand($conf['powerdns']['init_script'], 'restart').' &> /dev/null'); |
|
496 |
if($conf['bind']['installed'] == true && $conf['bind']['init_script'] != '') system($inst->getinitcommand($conf['bind']['init_script'], 'restart').' &> /dev/null'); |
8896ab
|
497 |
} |
7fe908
|
498 |
|
8896ab
|
499 |
if($conf['services']['proxy']) { |
7fe908
|
500 |
// if($conf['squid']['installed'] == true && $conf['squid']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['squid']['init_script'])) system($conf['init_scripts'].'/'.$conf['squid']['init_script'].' restart &> /dev/null'); |
33bcd0
|
501 |
if($conf['nginx']['installed'] == true && $conf['nginx']['init_script'] != '') system($inst->getinitcommand($conf['nginx']['init_script'], 'restart').' &> /dev/null'); |
8896ab
|
502 |
} |
7fe908
|
503 |
|
8896ab
|
504 |
if($conf['services']['firewall']) { |
7fe908
|
505 |
//if($conf['ufw']['installed'] == true && $conf['ufw']['init_script'] != '' && is_executable($conf['init_scripts'].'/'.$conf['ufw']['init_script'])) system($conf['init_scripts'].'/'.$conf['ufw']['init_script'].' restart &> /dev/null'); |
8896ab
|
506 |
} |
N |
507 |
} |
|
508 |
|
1ed92e
|
509 |
//* Create md5 filelist |
TB |
510 |
$md5_filename = '/usr/local/ispconfig/security/data/file_checksums_'.date('Y-m-d_h-i').'.md5'; |
|
511 |
exec('find /usr/local/ispconfig -type f -print0 | xargs -0 md5sum > '.$md5_filename); |
|
512 |
chmod($md5_filename,0700); |
|
513 |
|
8896ab
|
514 |
echo "Update finished.\n"; |
N |
515 |
|
|
516 |
?> |