| | |
| | | } |
| | | } |
| | | |
| | | function checkDbHealth() { |
| | | global $conf; |
| | | |
| | | //* Array containing non OK tables (can be repaired, crashed, corrupt) |
| | | $notok = array(); |
| | | |
| | | echo "Checking ISPConfig database .. "; |
| | | exec("mysqlcheck -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' -p'".$conf['mysql']['admin_password']."' -r ".$conf["mysql"]["database"], $result); |
| | | for( $i=0; $i<sizeof($result);$i++) { |
| | | if ( substr($result[$i], -2) != "OK" ) { |
| | | $notok[] = $result[$i]; |
| | | } |
| | | } |
| | | |
| | | if ( sizeof($notok) > 0 ) { |
| | | echo "\nSome tables where not 'OK'. Please check the list below.\n\n"; |
| | | foreach ($notok as $key => $value) { |
| | | echo "$value\n"; |
| | | } |
| | | echo "\nPress enter to continue or CTRL-C to cancel the installation .."; |
| | | sread(); |
| | | } |
| | | else |
| | | echo "OK\n"; |
| | | } |
| | | |
| | | function updateDbAndIni() { |
| | | global $inst, $conf; |
| | | |
| | |
| | | $conf['services']['file'] = ($tmp['file_server'] == 1)?true:false; |
| | | $conf['services']['db'] = ($tmp['db_server'] == 1)?true:false; |
| | | $conf['services']['vserver'] = ($tmp['vserver_server'] == 1)?true:false; |
| | | $conf['services']['proxy'] = (isset($tmp['proxy_server']) && $tmp['proxy_server'] == 1)?true:false; |
| | | $conf['services']['firewall'] = (isset($tmp['firewall_server']) && $tmp['firewall_server'] == 1)?true:false; |
| | | |
| | | $conf['postfix']['vmail_mailbox_base'] = $ini_array['mail']['homedir_path']; |
| | | |
| | | //* Do incremental DB updates only on installed ISPConfig versions > 3.0.3 |
| | |
| | | } else { |
| | | system("mysql --default-character-set=".$conf['mysql']['charset']." --force -h '".$conf['mysql']['host']."' -u '".$conf['mysql']['admin_user']."' ".$conf['mysql']['database']." < existing_db.sql"); |
| | | } |
| | | |
| | | //** Get the database version number based on the patchfile |
| | | $found = true; |
| | | while($found == true) { |
| | | $next_db_version = intval($current_db_version + 1); |
| | | $patch_filename = realpath(dirname(__FILE__).'/../').'/sql/incremental/upd_'.str_pad($next_db_version, 4, '0', STR_PAD_LEFT).'.sql'; |
| | | if(is_file($patch_filename)) { |
| | | $current_db_version = $next_db_version; |
| | | } else { |
| | | $found = false; |
| | | } |
| | | } |
| | | |
| | | //* update the database version in server table |
| | | $inst->db->query("UPDATE ".$conf["mysql"]["database"].".server SET dbversion = '".$current_db_version."' WHERE server_id = ".$conf['server_id']); |
| | | |
| | | if ($conf['powerdns']['installed']) { |
| | | |