예제 #1
0
function fixExtraDB()
{
    $sq = new Sqlite(null, 'client');
    $sq->rawQuery("update monitorserver set priv_q_monitorport_num = 'Unlimited'");
    $sq->rawQuery("update client set priv_q_monitorport_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_monitorserver_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vmipaddress_a_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_process_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_realmem_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ncpu_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ioprio_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_cpuunit_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_swap_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ip_manage_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_iptables_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vps_add_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vps_limit_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_secondlevelquota_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_centralbackup_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update pserver set parent_clname = 'client-admin'");
    $sq->rawQuery("update vps set iid = vpsid where iid is null");
    $sq->rawQuery("update vps set iid = vpsid where iid = ''");
    $sq->rawQuery("update vps set priv_q_swap_usage = 2 * priv_q_realmem_usage where priv_q_swap_usage = ''");
    $sq->rawQuery("update vps set priv_q_swap_usage = 2 * priv_q_realmem_usage where priv_q_swap_usage is null");
    $sq->rawQuery("update vps set priv_q_swap_usage = 'Unlimited' where priv_q_swap_usage = 0");
    $sq->rawQuery("update vps set priv_q_centralbackup_flag = centralbackup_flag where priv_q_centralbackup_flag = ''");
    $sq->rawQuery("update vps set priv_q_centralbackup_flag = centralbackup_flag where priv_q_centralbackup_flag is null");
    $sq->rawQuery("update vps set kloxo_flag = lxadmin_flag where kloxo_flag is null");
    $sq->rawQuery("update vps set kloxo_flag = lxadmin_flag where kloxo_flag = ''");
    db_set_default('vps', 'kloxo_flag', 'on');
    db_set_default('vps', 'priv_q_managedns_flag', 'on');
    db_set_default('client', 'priv_q_managedns_flag', 'on');
    db_set_default('vps', 'priv_q_managereversedns_flag', 'on');
    db_set_default('client', 'priv_q_managereversedns_flag', 'on');
    db_set_default('client', 'priv_q_centralbackup_flag', 'on');
    db_set_default('vps', 'priv_q_rebuildvps_flag', 'on');
    db_set_default('client', 'priv_q_rebuildvps_flag', 'on');
    db_set_default('ippool', 'freeflag', 'on');
    initDbLoginPre();
    migrateResourceplan('vps');
    $sq->rawQuery("update resourceplan set realname = nname where realname = ''");
    $sq->rawQuery("update resourceplan set realname = nname where realname is null");
    $sq->rawQuery("alter table dns change ser_dns_record_a ser_dns_record_a longtext");
    lxshell_php("../bin/common/fixresourceplan.php");
    call_with_flag("convert_favorite");
}
예제 #2
0
function fixExtraDB()
{
    print "Fix database\n";
    $sq = new Sqlite(null, 'client');
    $sq->rawQuery("update monitorserver set priv_q_monitorport_num = 'Unlimited'");
    $sq->rawQuery("update client set priv_q_monitorport_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_monitorserver_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vmipaddress_a_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_process_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_realmem_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ncpu_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ioprio_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_cpuunit_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_swap_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_backup_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_ip_manage_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_iptables_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vps_add_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_vps_limit_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_secondlevelquota_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_centralbackup_flag = 'On' where nname = 'admin'");
    $sq->rawQuery("update pserver set parent_clname = 'client-admin'");
    $sq->rawQuery("update vps set iid = vpsid where iid is null");
    $sq->rawQuery("update vps set iid = vpsid where iid = ''");
    $sq->rawQuery("update vps set priv_q_swap_usage = 2 * priv_q_realmem_usage where priv_q_swap_usage = ''");
    $sq->rawQuery("update vps set priv_q_swap_usage = 2 * priv_q_realmem_usage where priv_q_swap_usage is null");
    $sq->rawQuery("update vps set priv_q_swap_usage = 'Unlimited' where priv_q_swap_usage = 0");
    $sq->rawQuery("update vps set priv_q_centralbackup_flag = centralbackup_flag where priv_q_centralbackup_flag = ''");
    $sq->rawQuery("update vps set priv_q_centralbackup_flag = centralbackup_flag where priv_q_centralbackup_flag is null");
    db_set_default('vps', 'kloxo_flag', 'off');
    db_set_default('vps', 'priv_q_managedns_flag', 'on');
    db_set_default('vps', 'priv_q_managereversedns_flag', 'on');
    db_set_default('vps', 'priv_q_rebuildvps_flag', 'on');
    db_set_default('client', 'priv_q_managedns_flag', 'on');
    db_set_default('client', 'priv_q_managereversedns_flag', 'on');
    db_set_default('client', 'priv_q_centralbackup_flag', 'on');
    db_set_default('client', 'priv_q_rebuildvps_flag', 'on');
    db_set_default('ippool', 'freeflag', 'on');
    db_set_default('vps', 'ttype', 'openvz');
    db_set_default("vps", "swapdiskname", "vm.swap", "ttype = 'xen'");
    db_set_default("vps", "maindiskname", "root.img", "ttype = 'xen'");
    db_set_default('vps', 'corerootdir', '/vz/private', "ttype = 'openvz'");
    db_set_default("vps", "corerootdir", "/home/xen", "ttype = 'xen'");
    db_set_default('pserver', 'coma_psrole_a', 'vps');
    initDbLoginPre();
    print "Fix database (Resource plans)\n";
    migrateResourceplan('vps');
    $sq->rawQuery("update resourceplan set realname = nname where realname = ''");
    $sq->rawQuery("update resourceplan set realname = nname where realname is null");
    $sq->rawQuery("alter table dns change ser_dns_record_a ser_dns_record_a longtext");
    lxshell_php("../bin/common/fixresourceplan.php");
    print "Fix database (Favorites)\n";
    call_with_flag("convert_favorite");
    lxfile_touch($file);
}
예제 #3
0
파일: updatelib.php 프로젝트: zseand/kloxo
function fixDataBaseIssues()
{
    log_cleanup("Fix Database Issues");
    log_cleanup("- Fix admin account database settings");
    $sq = new Sqlite(null, 'domain');
    $sq->rawQuery("update domain set priv_q_php_flag = 'on'");
    $sq->rawQuery("update web set priv_q_php_flag = 'on'");
    $sq->rawQuery("update client set priv_q_php_flag = 'on'");
    $sq->rawQuery("update client set priv_q_addondomain_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_rubyrails_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_rubyfcgiprocess_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_mysqldb_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_phpfcgi_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_phpfcgiprocess_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_subdomain_num = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_totaldisk_usage = 'Unlimited' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_php_manage_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_installapp_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_cron_minute_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_document_root_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_runstats_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update client set priv_q_webhosting_flag = 'on' where nname = 'admin'");
    $sq->rawQuery("update ticket set parent_clname = 'client-admin' where subject = 'Welcome to Kloxo'");
    $sq->rawQuery("update domain set dtype = 'maindomain' where dtype = 'domain'");
    log_cleanup("- Set default database settings");
    db_set_default('mmail', 'remotelocalflag', 'local');
    db_set_default('mmail', 'syncserver', 'localhost');
    db_set_default('dns', 'syncserver', 'localhost');
    db_set_default('pserver', 'coma_psrole_a', ',web,dns,mmail,mysqldb,');
    db_set_default('web', 'syncserver', 'localhost');
    db_set_default('uuser', 'syncserver', 'localhost');
    db_set_default('client', 'syncserver', 'localhost');
    db_set_default('addondomain', 'mail_flag', 'on');
    db_set_default('client', 'priv_q_can_change_limit_flag', 'on');
    db_set_default('web', 'priv_q_installapp_flag', 'on');
    db_set_default('client', 'priv_q_installapp_flag', 'on');
    db_set_default('client', 'websyncserver', 'localhost');
    db_set_default('client', 'mmailsyncserver', 'localhost');
    db_set_default('client', 'mysqldbsyncserver', 'localhost');
    db_set_default('client', 'priv_q_can_change_password_flag', 'on');
    db_set_default('client', 'coma_dnssyncserver_list', ',localhost,');
    db_set_default('domain', 'priv_q_installapp_flag', 'on');
    db_set_default('domain', 'dtype', 'domain');
    db_set_default('domain', 'priv_q_php_manage_flag', 'on');
    db_set_default('web', 'priv_q_php_manage_flag', 'on');
    db_set_default('client', 'priv_q_php_manage_flag', 'on');
    db_set_default('client', 'priv_q_webhosting_flag', 'on');
    db_set_default_variable_diskusage('client', 'priv_q_totaldisk_usage', 'priv_q_disk_usage');
    db_set_default_variable_diskusage('domain', 'priv_q_totaldisk_usage', 'priv_q_disk_usage');
    db_set_default_variable('web', 'docroot', 'nname');
    db_set_default_variable('client', 'used_q_maindomain_num', 'used_q_domain_num');
    db_set_default_variable('client', 'priv_q_maindomain_num', 'priv_q_domain_num');
    db_set_default("servermail", "domainkey_flag", "on");
    log_cleanup("- Fix resourceplan settings in database");
    migrateResourceplan('domain');
    $sq->rawQuery("update resourceplan set realname = nname where realname = ''");
    $sq->rawQuery("update resourceplan set realname = nname where realname is null");
    lxshell_php("../bin/common/fixresourceplan.php");
    log_cleanup("- Alter some database tables to fit that of Kloxo");
    // TODO: Check if this is still longer needed!
    $sq->rawQuery("alter table sslcert change text_ca_content text_ca_content longtext");
    $sq->rawQuery("alter table sslcert change text_key_content text_key_content longtext");
    $sq->rawQuery("alter table sslcert change text_csr_content text_csr_content longtext");
    $sq->rawQuery("alter table sslcert change text_crt_content text_crt_content longtext");
    $sq->rawQuery("alter table mailaccount change ser_forward_a ser_forward_a longtext");
    $sq->rawQuery("alter table dns change ser_dns_record_a ser_dns_record_a longtext");
    $sq->rawQuery("alter table installsoft change ser_installappmisc_b ser_installappmisc_b longtext");
    $sq->rawQuery("alter table web change ser_redirect_a ser_redirect_a longtext");
    log_cleanup("- Set default welcome text at Kloxo login page");
    initDbLoginPre();
    log_cleanup("- Remove default db password if exists");
    critical_change_db_pass();
}