예제 #1
0
파일: lib.php 프로젝트: lonelywoolf/hypervm
function fix_rhn_sources_file()
{
    $os = findOperatingSystem('pointversion');
    $list = lfile("/etc/sysconfig/rhn/sources");
    foreach ($list as $k => $l) {
        $l = trim($l);
        if (!$l) {
            continue;
        }
        if (csb($l, "yum lxcenter")) {
            continue;
        }
        $outlist[$k] = $l;
    }
    $outlist[] = "\n";
    $outlist[] = "yum lxcenter-base http://download.lxcenter.org/download/update/{$os}/\$ARCH/";
    $outlist[] = "yum lxcenter-extra http://download.lxcenter.org/download/update/lxgeneral/";
    lfile_put_contents("/etc/sysconfig/rhn/sources", implode("\n", $outlist) . "\n");
    $cont = lfile_get_contents("__path_program_htmlbase/htmllib/filecore/lxcenter.repo.template");
    $cont = str_replace("%distro%", $os, $cont);
    lfile_put_contents("/etc/yum.repos.d/lxcenter.repo", $cont);
}
예제 #2
0
파일: lxlib.php 프로젝트: zseand/kloxo
function getAllOperatingSystemDetails()
{
    $ret = findOperatingSystem();
    $ret['loadavg'] = os_getLoadAvg();
    dprintr($ret);
    return $ret;
}
예제 #3
0
 function __construct()
 {
     $this->__var_service_desc['httpd'] = "Apache Web Server";
     $this->__var_service_desc['apache2'] = "Apache Web Server";
     $this->__var_service_desc['qmail'] = "Qmail Mail Server";
     $this->__var_service_desc['named'] = "Bind DNS Server";
     $this->__var_service_desc['bind9'] = "Bind DNS Server";
     $this->__var_service_desc['pure-ftpd'] = "PureFTP FTP Server";
     $this->__var_service_desc['courier'] = "Courier POP/IMAP Server";
     $this->__var_service_desc['courier-imap'] = "Courier POP/IMAP Server";
     $this->__ver_major = "2";
     $this->__ver_minor = "1";
     $this->__ver_release = "0";
     $this->__ver_enterprise = null;
     $this->__ver_type = "production";
     // Not used
     $this->__ver_extra = "Stable";
     $this->__ver_major_minor = $this->__ver_major . "." . $this->__ver_minor;
     $this->__ver_major_minor_release = $this->__ver_major . "." . $this->__ver_minor . "." . $this->__ver_release;
     $this->__var_nname_impstr = "___";
     $this->__var_prog_port = "8888";
     $this->__var_prog_ssl_port = "8887";
     $this->__var_cttype = array();
     $this->__var_cttype['superadmin'] = 4;
     $this->__var_cttype['superclient'] = 5;
     $this->__var_cttype['node'] = 7;
     $this->__var_cttype['admin'] = 11;
     $this->__var_cttype['master'] = 15;
     $this->__var_cttype['wholesale'] = 20;
     $this->__var_cttype['reseller'] = 30;
     $this->__var_cttype['customer'] = 40;
     $this->__var_cttype['pserver'] = 50;
     $this->__var_cttype['domain'] = 60;
     $this->__var_cttype['uuser'] = 70;
     $this->__var_cttype['ftpuser'] = 80;
     $this->__var_cttype['mailaccount'] = 90;
     $this->__var_ltype = array();
     $this->__var_ltype['hypervmaccount'] = 'client';
     $this->__var_ltype['serveradmin'] = 'pserver';
     $this->__var_ltype['domainowner'] = 'domain';
     $this->__var_ltype['sysuser'] = '******';
     $this->__var_ltype['mailuser'] = '******';
     $this->__var_ltype['ftpuser'] = '******';
     $this->__var_ltype['superclient'] = 'superclient';
     parent::__construct();
     $this->__var_quote_char = "'";
     $this->__var_database_type = "mysql";
     $this->__path_mysqlclient_path = "mysql";
     $this->__path_program_home = "/home/hypervm";
     $this->__path_mysqldump_path = "mysqldump";
     $this->__var_noaccess_shell = '/sbin/nologin';
     $this->__path_named_path = "/var/named";
     $this->__path_iptraffic_file = "/var/log/lxiptraffic.log";
     $this->__path_vps_root = "/vz/private/";
     $this->__path_home_dir = "/home";
     $this->__path_named_conf = "/etc/hypervm.named.conf";
     $this->__path_named_chroot = "";
     $this->__path_home_root = "/home/hypervm";
     $this->__path_apache_path = "/etc/httpd/conf/";
     $this->__path_cron_root = '/var/spool/cron/';
     $this->__path_real_etc_root = "/etc/";
     $this->__path_httpd_root = "/home/httpd";
     $this->__path_client_root = "/home/hypervm/client";
     $this->__path_mail_root = "/home/hypervm/mail";
     $this->__path_hypervm_httpd_root = "/home/hypervm/httpd";
     $this->__path_lxlabs_base = "/usr/local/lxlabs";
     $this->__path_program_etc = "/usr/local/lxlabs/hypervm/etc/";
     $this->__path_program_root = "/usr/local/lxlabs/hypervm";
     $this->__path_program_htmlbase = "/usr/local/lxlabs/hypervm/httpdocs";
     $this->__path_php_path = $this->__path_lxlabs_base . "/ext/php/php";
     $this->__var_program_name = 'hypervm';
     $this->__path_serverfile = $this->__path_lxlabs_base . "/hypervm/serverfile";
     $this->__path_download_dir = $this->__path_lxlabs_base . "/hypervm/download";
     $this->__path_program_start_vps_flag = "{$this->__path_program_root}/etc/flag/start_vps.flg";
     //Default Values that will be overrriden in the hypervmconf file.
     $this->__var_programuser_dns = 'named';
     $this->__path_named_chroot = "/var/named/chroot/";
     $this->__var_programname_web = 'httpd';
     $this->__var_programname_ftp = 'pure-ftpd';
     $this->__var_programname_syslog = 'syslog';
     $this->__var_programname_dns = 'named';
     $this->__var_programname_mmail = 'qmail';
     $this->__var_programname_imap = 'courier';
     $this->__var_programuser_dns = 'named';
     $this->__var_no_sync = false;
     $this->__path_ssl_root = $this->__path_hypervm_httpd_root . "/ssl";
     $this->__var_mssqlport = '7773';
     $this->__var_local_port = '8886';
     $this->__var_remote_port = '8889';
     $conffile = "{$this->__path_program_root}/file/conf/os.conf";
     if (!file_exists($conffile)) {
         $ret = findOperatingSystem();
         $os = $ret['os'];
         copy("{$this->__path_program_root}/file/conf/{$os}.conf", $conffile);
     }
     $this->__var_exit_char = "___...___";
     $this->__var_remote_char = "_._";
     $this->__var_connection_type = "tcp";
     include_once $conffile;
     if (!$conf) {
         print "Error Reading Config File...\n";
         exit;
     }
     foreach ($conf as $k => $v) {
         if (!is_array($v)) {
             print "Error in Config File Syntax... n";
             exit;
         }
         $vvarcore = "__{$k}_";
         foreach ($v as $nk => $nv) {
             $vvar = $vvarcore . $nk;
             $this->{$vvar} = $nv;
         }
     }
     $this->__path_dbschema = "{$this->__path_program_root}/file/.db_schema";
     $this->__var_dbf = "hypervm1_0";
     $this->__path_super_pass = $this->__path_program_etc . "/conf/superadmin.pass";
     $this->__path_admin_pass = $this->__path_program_etc . "/conf/hypervm.pass";
     $this->__path_master_pass = $this->__path_program_etc . "/conf/hypervm.pass";
     $this->__path_named_realpath = "{$this->__path_named_chroot}/{$this->__path_named_path}";
     $this->__var_super_user = "******";
     $this->__var_admin_user = "******";
     $this->__path_slave_db = $this->__path_program_etc . "/conf/slave-db.db";
     $this->__path_supernode_db = "lxasuper";
     $this->__path_sql_file_supernode = "{$this->__path_program_htmlbase}/sql/supernode";
     $this->__path_sql_file = "{$this->__path_program_htmlbase}/sql/full";
     $this->__path_sql_file_common = "{$this->__path_program_htmlbase}/sql/common";
     $this->__path_lxmisc = $this->__path_program_root . "/sbin/lxmisc";
     $this->__var_action_class = array('vps');
     $this->__var_rolelist = array("web", "mail", "dns", "secondary_master");
     $this->__var_dblist = array("mysql");
     $this->__var_error_file = "__path_program_root/httpdocs/.php.err";
     $this->__var_ticket_subcategory = null;
 }
예제 #4
0
 static function pserverInfo()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $osdet = findOperatingSystem();
     $path = "/proc/meminfo";
     $data = lfile($path);
     $res = self::parse_data($data);
     $unit = 1024;
     $ret['priv_s_memory'] = $res['memtotal'] / $unit;
     $ret['used_s_memory'] = ($res['memtotal'] - $res['memfree']) / $unit;
     $ret['priv_s_swap'] = $res['swaptotal'] / $unit;
     $ret['used_s_swap'] = ($res['swaptotal'] - $res['swapfree']) / $unit;
     $ret['used_s_membuffers'] = $res['buffers'] / $unit;
     $ret['used_s_memcached'] = $res['cached'] / $unit;
     // This is a hack to show the actual non-kloxo memory on openvz.
     if ($sgbl->isKloxo()) {
         if (lxfile_exists("/proc/user_beancounters")) {
             $ret['used_s_memory'] -= 20;
         }
     }
     foreach ($ret as &$vvv) {
         $vvv = round($vvv);
     }
     $path = "/proc/cpuinfo";
     $data = lfile($path);
     $processornum = 0;
     foreach ($data as $v) {
         if (!trim($v)) {
             continue;
         }
         $d = explode(':', $v);
         $d[0] = trim($d[0]);
         $d[1] = trim($d[1]);
         if ($d[0] === 'processor') {
             $processornum = $d[1];
             continue;
         }
         if ($d[0] === 'model name') {
             $cpu[$processornum]['used_s_cpumodel'] = $d[1];
         }
         if ($d[0] === 'cpu MHz') {
             $cpu[$processornum]['used_s_cpuspeed'] = round($d[1] / 100) / 10 . "GHz";
         }
         if ($d[0] === 'cache size') {
             $cpu[$processornum]['used_s_cpucache'] = $d[1];
         }
     }
     $ret['disk'] = diskusage__linux::getDiskUsage();
     $ret['lvm'] = vg_complete();
     $ret['cpu'] = $cpu;
     $ret['osdet'] = $osdet;
     return $ret;
 }
예제 #5
0
파일: sgbl.php 프로젝트: zseand/kloxo
    function __construct()
    {
        $this->arg_getting_string = '
		$arglist = array();
		for ($i = $start; $i < func_num_args(); $i++) {
			if (isset($transforming_func)) {
				$arglist[] = $transforming_func(func_get_arg($i));
			} else {
				$arglist[] = func_get_arg($i);
			}
		}';
        $this->initDeviceDescriptions();
        $this->initLanguages();
        $this->initLTypes();
        $this->initCtTypes();
        $this->__var_program_name = 'kloxo';
        $this->__ver_major = "6";
        $this->__ver_minor = "1";
        $this->__ver_release = "10";
        $this->__ver_enterprise = "Single Server Edition";
        $this->__ver_type = "production";
        $this->__ver_extra = "Stable";
        $this->__ver_major_minor = $this->__ver_major . "." . $this->__ver_minor;
        $this->__ver_major_minor_release = $this->__ver_major . "." . $this->__ver_minor . "." . $this->__ver_release;
        $this->__var_nname_impstr = "___";
        $this->__var_prog_port = "7778";
        $this->__var_prog_ssl_port = "7777";
        $this->__var_lxlabs_marker = "__lxlabs_marker";
        $this->__var_lpanelwidth = "220";
        if (windowsOs()) {
            $this->__var_quote_char = "\"";
            $this->__var_database_type = "sqlite";
            $this->__path_mysqldump_path = "C:/Program Files/lxlabs/ext/Mysql/";
            $this->__path_tmp = "c:/tmp";
            $this->__path_slash = "c:/tmp";
            $this->__path_user_root = "c:/usr";
            $this->__path_var_root = "c:/var";
            $this->__path_log = "d:/var/log";
            $this->__path_root_base = "my_computer";
            $this->__path_named_path = "c:/var/named";
            $this->__path_named_conf = "c:/etc/named.conf";
            $this->__path_apache_root = "c:/home/kloxo/httpd";
            $this->__path_apache_path = "d:/etc/httpd/conf";
            $this->__path_mysql_datadir = "/var/lib/mysql/";
            $this->__path_customer_root = "c:/webroot/";
            $this->__path_real_etc_root = "c:/etc/";
            $this->__path_etc_root = "C:/Program Files";
            $this->__ver_extra = "Beta";
            $this->__path_program_home = "c:/kloxo";
            $this->__path_home_dir = "d:/";
            $this->__path_client_root = "c:/home/kloxo/client";
            $this->__path_kloxo_httpd_root = "c:/Program Files/kloxodata";
            $this->__path_lxlabs_base = "c:/Program Files/lxlabs";
            $this->__path_program_root = "c:/Program Files/lxlabs/kloxo";
            $this->__path_program_htmlbase = "c:/Program Files/lxlabs/kloxo/httpdocs";
            $this->__path_mail_root = "c:/home/lxadmin/mail/domains";
            $this->__path_httpd_root = "c:/httproot";
            $this->__path_perl_path = "c:/Program Files/Perl/perl.exe";
            $this->__path_program_etc = "C:/Program Files/lxlabs/kloxo/etc";
            $this->__path_php_path = $this->__path_lxlabs_base . "/ext/php/php.exe";
        } else {
            $this->__var_quote_char = "'";
            $this->__path_perl_path = "/usr/bin/perl";
            $this->__path_kloxo_back_phpini = "/etc/kloxo-backup-php.ini";
            $this->__var_database_type = "mysql";
            $this->__path_mysqlclient_path = "mysql";
            $this->__path_mysqldump_path = "mysqldump";
            $this->__var_noaccess_shell = '/sbin/nologin';
            $this->__path_named_path = "/var/named";
            $this->__path_customer_root = "/home";
            $this->__path_mysql_datadir = "/var/lib/mysql/";
            $this->__path_slash = "/";
            $this->__path_tmp = "/tmp";
            $this->__path_user_root = "/usr";
            $this->__path_var_root = "/var";
            $this->__path_real_etc_root = "/etc";
            $this->__path_log = "/var/log";
            $this->__path_root_base = "/";
            $this->__path_mara_path = "";
            $this->__path_mara_chroot = "/etc/maradns/";
            $this->__path_mara_conf = "/etc/mararc";
            $this->__path_program_home = "/home/kloxo";
            $this->__path_home_dir = "/home";
            $this->__path_named_conf = "/etc/kloxo.named.conf";
            $this->__path_named_chroot = "";
            $this->__path_home_root = "/home/kloxo";
            $this->__path_apache_path = "/etc/httpd/conf/";
            $this->__path_lighty_path = "/etc/lighttpd/";
            $this->__path_cron_root = '/var/spool/cron/';
            $this->__path_real_etc_root = "/etc/";
            $this->__path_httpd_root = "/home/httpd";
            $this->__path_client_root = "/home/kloxo/client";
            $this->__path_mail_root = "/home/lxadmin/mail";
            $this->__path_kloxo_httpd_root = "/home/kloxo/httpd";
            $this->__path_lxlabs_base = "/usr/local/lxlabs";
            $this->__path_program_etc = "/usr/local/lxlabs/kloxo/etc/";
            $this->__path_program_root = "/usr/local/lxlabs/kloxo";
            $this->__path_program_htmlbase = "/usr/local/lxlabs/kloxo/httpdocs";
            $this->__path_php_path = $this->__path_lxlabs_base . "/ext/php/php";
        }
        $this->__path_serverfile = $this->__path_lxlabs_base . "/kloxo/serverfile";
        $this->__path_download_dir = $this->__path_lxlabs_base . "/kloxo/download";
        $this->__path_program_start_vps_flag = $this->__path_program_root . "/etc/flag/start_vps.flg";
        $this->__path_installapp_servervar = $this->__path_kloxo_httpd_root . "/installappdata/lx_template.servervars.phps";
        //Default Values that will be overrriden in the kloxoconf file.
        $this->__path_named_chroot = "/var/named/chroot/";
        $this->__var_progservice_apache = 'httpd';
        $this->__var_programname_ftp = 'pure-ftpd';
        $this->__var_programname_syslog = 'syslog';
        //$this->__var_programname_mysql = 'mysqld';
        $this->__var_progservice_bind = 'named';
        $this->__var_programname_mmail = 'qmail';
        $this->__var_programname_imap = 'courier-imap';
        $this->__var_programuser_dns = 'named';
        $this->__var_no_sync = false;
        $this->__path_ssl_root = $this->__path_kloxo_httpd_root . "/ssl";
        $this->__path_named_realpath = "{$this->__path_named_chroot}/{$this->__path_named_path}";
        $this->__var_mssqlport = '7773';
        $this->__var_local_port = '7776';
        $this->__var_remote_port = '7779';
        $conffile = "{$this->__path_program_root}/file/conf/os.conf";
        if (!file_exists($conffile)) {
            $ret = findOperatingSystem();
            $os = $ret['os'];
            copy("{$this->__path_program_root}/file/conf/{$os}.conf", $conffile);
        }
        $this->__var_exit_char = "___...___";
        $this->__var_remote_char = "_._";
        $this->__var_connection_type = "tcp";
        include_once $conffile;
        if (!$conf) {
            print "Error Reading Config File...\n";
            exit;
        }
        foreach ($conf as $k => $v) {
            if (!is_array($v)) {
                print "Error in Config File Syntax...\n";
                exit;
            }
            $vvarcore = "__{$k}_";
            foreach ($v as $nk => $nv) {
                $vvar = $vvarcore . $nk;
                $this->{$vvar} = $nv;
            }
        }
        $this->__path_dbschema = "{$this->__path_program_root}/file/.db_schema";
        if ($this->__var_database_type === "sqlite") {
            $this->__var_dbf = "{$this->__path_program_etc}/conf/db.db";
        } else {
            $this->__var_dbf = "kloxo";
        }
        $this->__path_super_pass = $this->__path_program_etc . "/conf/superadmin.pass";
        $this->__path_admin_pass = $this->__path_program_etc . "/conf/kloxo.pass";
        $this->__path_master_pass = $this->__path_program_etc . "/conf/kloxo.pass";
        $this->__var_super_user = "******";
        $this->__var_admin_user = "******";
        $this->__path_slave_db = $this->__path_program_etc . "/conf/slave-db.db";
        $this->__path_supernode_db = "lxasuper";
        $this->__path_sql_file_supernode = "{$this->__path_program_htmlbase}/sql/supernode";
        $this->__path_sql_file = "{$this->__path_program_htmlbase}/sql/full";
        $this->__path_sql_file_common = "{$this->__path_program_htmlbase}/sql/common";
        $this->__path_updating_file = $this->__path_program_etc . "/.updating";
        $this->__path_httpd_conf_file = $this->__path_apache_path . "/httpd.conf";
        $this->__path_mail_log = $this->__path_log . "/maillog";
        $this->__path_boot_log = $this->__path_log . "/boot.log";
        $this->__path_cron_log = $this->__path_log . "/cron";
        $this->__path_mysql_log = $this->__path_log . "/mysqld.log";
        $this->__path_vsftpd_log = $this->__path_log . "/vsftpd.log";
        $this->__path_lxmisc = $this->__path_program_root . "/sbin/lxmisc";
        $this->__var_rolelist = array("web", "mail", "dns", "secondary_master");
        $this->__var_dblist = array("mysql");
        $this->__var_error_file = "__path_program_root/httpdocs/.php.err";
        $this->__var_ticket_subcategory = null;
    }