function dosyncToSystemPost()
 {
     global $sgbl;
     $ret = lxshell_return("rndc", "reload");
     if ($ret) {
         createRestartFile("bind");
     }
 }
Example #2
0
function remove_lighttpd_error_log()
{
    $f = "/home/kloxo/httpd/lighttpd/error.log";
    $s = lxfile_size($f);
    if ($s > 50 * 1024 * 1024) {
        lunlink($f);
        createRestartFile("lighttpd");
    }
}
 static function installMe()
 {
     $ret = lxshell_return("yum", "-y", "install", "spamassassin");
     if ($ret) {
         throw new lxexception('install_spamassassin_failed', 'parent');
     }
     lxshell_return("chkconfig", "spamassassin", "on");
     lxfile_cp("../file/sysconfig_spamassassin", "/etc/sysconfig/spamassassin");
     createRestartFile("spamassassin");
 }
Example #4
0
 function createDiruserfile()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $result = $this->main->__var_davuser;
     $res = null;
     foreach ($result as $r) {
         $cr = crypt($r['realpass']);
         //$cr = $r['realpass'];
         $res .= "{$r['username']}:{$cr}\n";
     }
     lxfile_mkdir("__path_httpd_root/{$this->main->getParentName()}/__davuser");
     lfile_put_contents("__path_httpd_root/{$this->main->getParentName()}/__davuser/davuser", $res);
     $this->createDavSuexec();
     $string = $this->createVirtualHost();
     lfile_put_contents("/home/kloxo/httpd/webdisk/virtualhost.conf", $string);
     createRestartFile("webdisk");
 }
Example #5
0
 static function createDhcpConfFile($slist)
 {
     $list = os_get_allips();
     foreach ($list as $l) {
         $base = strtil($l, ".");
         $subnet[$base] = null;
     }
     $string = null;
     $string .= "ddns-update-style interim;\n";
     $string .= "ignore client-updates;\n\n\n";
     $string .= self::getSubnetString($k, $slist);
     /*
     	foreach($subnet as $k => $v) {
     		$string .= self::getSubnetString($k, $slist);
     	}
     */
     foreach ($slist as $s) {
         $string .= self::getHostString($s);
     }
     lfile_put_contents("/etc/dhcpd.conf", $string);
     createRestartFile("dhcpd");
 }
 function dbactionUpdate($subaction)
 {
     $name = sslcert::getSslCertnameFromIP($this->main->nname);
     $path = "__path_ssl_root";
     $contentscer = $this->main->text_crt_content;
     $contentskey = $this->main->text_key_content;
     $contentsca = trim($this->main->text_ca_content);
     if (!$contentscer || !$contentskey) {
         throw new lxException("certificate_key_file_empty", '');
     }
     sslcert::checkAndThrow($contentscer, $contentskey, $name);
     lfile_put_contents("{$path}/{$name}.crt", $contentscer);
     lfile_put_contents("{$path}/{$name}.key", $contentskey);
     $contentpem = "{$contentscer}\n{$contentskey}";
     lfile_put_contents("{$path}/{$name}.pem", $contentpem);
     if ($contentsca) {
         lfile_put_contents("{$path}/{$name}.ca", $contentsca);
     } else {
         lxfile_cp("htmllib/filecore/program.ca", "{$path}/{$name}.ca");
     }
     createRestartFile($this->main->__var_webdriver);
 }
Example #7
0
 static function switchProgramPost($old, $new)
 {
     createRestartFile($new);
 }
Example #8
0
 static function switchProgramPost($old, $new)
 {
     if ($new === 'spamassassin') {
         lxfile_cp("../file/sysconfig_spamassassin", "/etc/sysconfig/spamassassin");
         createRestartFile("spamassassin");
     }
 }
Example #9
0
function updatecleanup_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    $program = $sgbl->__var_program_name;
    $opt = parse_opt($argv);
    if ($opt['type'] === 'master') {
        initProgram('admin');
        $flg = "__path_program_start_vps_flag";
        if (!lxfile_exists($flg)) {
            set_login_skin_to_feather();
        }
    } else {
        $login = new Client(null, null, 'update');
    }
    log_cleanup("*** Executing Update (cleanup) - BEGIN ***");
    // Do things that is needed before the cleanup starts.
    print "########################################\n";
    print "##        Executing PreCleanup        ##\n";
    print "########################################\n";
    doBeforeUpdate();
    print "########################################\n";
    print "##        Finished PreCleanup         ##\n";
    print "########################################\n";
    if (lxfile_exists('.git')) {
        log_cleanup('- Development found!');
    }
    if ($opt['type'] === 'master') {
        $sgbl->slave = false;
        if (!is_secondary_master()) {
            updateDatabaseProperly();
            fixDataBaseIssues();
            doUpdates();
            lxshell_return("__path_php_path", "../bin/common/driverload.php");
        }
        update_all_slave();
        cp_dbfile();
    } else {
        $sgbl->slave = true;
    }
    if (!is_secondary_master()) {
        updatecleanup();
    }
    if ($opt['type'] === 'master') {
        lxfile_touch("__path_program_start_vps_flag");
    }
    // issue #716 -- [beta] Unresolved dependency on Apache version
    // --- remove httpd-itk rpm (from webtatic.repo or others) because may conflict with
    // httpd 2.2.21 that include mpm itk beside mpm worker and event
    exec("rpm -q httpd-itk | grep -i 'not installed'", $out, $ret);
    // --- not work with !$ret
    if ($ret !== 0) {
        log_cleanup("Remove httpd-itk rpm package");
        log_cleanup("- Remove httpd-itk");
        exec("rpm -e httpd-itk --nodeps");
        exec("rpm -q httpd | grep -i 'not installed'", $out2, $ret2);
        if ($ret2 === 0) {
            log_cleanup("- Reinstall httpd");
            exec("yum reinstall httpd -y");
        }
    }
    // MR -- mysql not start after kloxo slave install
    log_cleanup("Preparing MySQL service");
    log_cleanup("- MySQL activated");
    exec("chkconfig mysqld on");
    log_cleanup("- MySQL restarted");
    exec("service mysqld restart");
    // MR -- importance for update from 6.1.6 or previous where change apache/lighttpd structure
    // or others for next version
    $slist = array("httpd*", "lighttpd*", "bind*", "djbdns*", "pure-ftpd*", "php*", "vpopmail", "courier-imap-toaster", "courier-authlib-toaster", "qmail", "safecat", "spamassassin", "bogofilter", "ezmlm-toaster", "autorespond-toaster", "clamav-toaster");
    setUpdateServices($slist);
    // MR -- use this trick for qmail non-daemontools based
    log_cleanup("Preparing some services again");
    log_cleanup("- courier-imap enabled and restart queue");
    exec("chkconfig courier-imap on");
    createRestartFile("courier-imap");
    log_cleanup("- qmail enabled and restart queue");
    exec("chkconfig qmail on");
    createRestartFile("qmail");
    $fixapps = array("dns", "web", "php", "mail", "ftpuser", "vpop");
    setUpdateConfigWithVersionCheck($fixapps, $opt['type']);
    // --- for anticipate change xinetd listing
    exec("service xinetd restart");
}
Example #10
0
 static function rotateLog($processedir, $file)
 {
     $stat = stat($file);
     if ($stat['size'] >= 10 * 1024 * 1024) {
         lxfile_mv($file, getNotexistingFile($processedir, basename($file)));
         createRestartFile("syslog");
     }
     $list = lscandir_without_dot($processedir);
     foreach ($list as $k) {
         $file = "{$processedir}/{$k}";
         $stat = stat($file);
         if ($stat['mtime'] < time() - 10 * 24 * 3600) {
             dprint("deleting old log {$file}\n");
             lxfile_rm($file);
         }
     }
 }
Example #11
0
 function dosyncToSystemPost()
 {
     global $gbl, $sgbl, $login, $ghtml;
     if (!$this->isOn('norestart')) {
         createRestartFile("apache");
     }
 }
Example #12
0
function collect_quota_later()
{
    createRestartFile("lxcollectquota");
}
Example #13
0
function updatecleanup_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    $program = $sgbl->__var_program_name;
    $opt = parse_opt($argv);
    if ($opt['type'] === 'master') {
        initProgram('admin');
        $flg = "__path_program_start_vps_flag";
        if (!lxfile_exists($flg)) {
            set_login_skin_to_feather();
        }
    } else {
        $login = new Client(null, null, 'update');
    }
    log_cleanup("*** Executing Update (cleanup) - BEGIN ***");
    //
    // Check for lxlabs yum repo file and if exists
    // Change to lxcenter repo file
    //
    if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
        log_cleanup("- Deleting old lxlabs yum repo");
        lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
        exec("rm -f /etc/yum.repos.d/lxlabs.repo");
        log_cleanup("- Removed lxlabs.repo");
        log_cleanup("- Installing lxcenter.repo");
        exec("wget -O /etc/yum.repos.d/lxcenter.repo http://download.lxcenter.org/lxcenter.repo");
        log_cleanup("- Installing yum-protectbase plugin");
        exec("yum install -y -q yum-protectbase");
    }
    // Fix #388 - phpMyAdmin config.inc.php permission
    $correct_perm = "0644";
    $check_perm = substr(decoct(fileperms("/usr/local/lxlabs/{$program}/httpdocs/thirdparty/phpMyAdmin/config.inc.php")), 2);
    if ($check_perm != $correct_perm) {
        lxfile_unix_chmod("/usr/local/lxlabs/{$program}/httpdocs/thirdparty/phpMyAdmin/config.inc.php", "0644");
    }
    //
    if (lxfile_exists(".svn")) {
        log_cleanup("- SVN Found... Exiting");
        exit;
    }
    if ($opt['type'] === 'master') {
        $sgbl->slave = false;
        if (!is_secondary_master()) {
            updateDatabaseProperly();
            fixDataBaseIssues();
            doUpdates();
            lxshell_return("__path_php_path", "../bin/common/driverload.php");
        }
        update_all_slave();
        cp_dbfile();
    } else {
        $sgbl->slave = true;
    }
    if (!is_secondary_master()) {
        updatecleanup();
    }
    if ($opt['type'] === 'master') {
        lxfile_touch("__path_program_start_vps_flag");
    }
    // issue #716 -- [beta] Unresolved dependency on Apache version
    // --- remove httpd-itk rpm (from webtatic.repo or others) because may conflict with
    // httpd 2.2.21 that include mpm itk beside mpm worker and event
    exec("rpm -q httpd-itk | grep -i 'not installed'", $out, $ret);
    // --- not work with !$ret
    if ($ret !== 0) {
        log_cleanup("Remove httpd-itk rpm package");
        log_cleanup("- Remove httpd-itk");
        exec("rpm -e httpd-itk --nodeps");
        exec("rpm -q httpd | grep -i 'not installed'", $out2, $ret2);
        if ($ret2 === 0) {
            log_cleanup("- Reinstall httpd");
            exec("yum reinstall httpd -y");
        }
    }
    // MR -- mysql not start after kloxo slave install
    log_cleanup("Preparing MySQL service");
    log_cleanup("- MySQL activated");
    exec("chkconfig mysqld on");
    log_cleanup("- MySQL restarted");
    exec("service mysqld restart");
    // MR -- importance for update from 6.1.6 or previous where change apache/lighttpd structure
    // or others for next version
    $slist = array("httpd*", "lighttpd*", "bind*", "djbdns*", "pure-ftpd*", "php*", "vpopmail", "courier-imap-toaster", "courier-authlib-toaster", "qmail", "safecat", "spamassassin", "bogofilter", "ezmlm-toaster", "autorespond-toaster", "clamav-toaster");
    setUpdateServices($slist);
    // MR -- use this trick for qmail non-daemontools based
    log_cleanup("Preparing some services again");
    log_cleanup("- courier-imap enabled and restart queue");
    exec("chkconfig courier-imap on");
    createRestartFile("courier-imap");
    log_cleanup("- qmail enabled and restart queue");
    exec("chkconfig qmail on");
    createRestartFile("qmail");
    $fixapps = array("dns", "web", "php", "mail", "ftpuser", "vpop");
    setUpdateConfigWithVersionCheck($fixapps, $opt['type']);
    // --- for anticipate change xinetd listing
    exec("service xinetd restart");
}
Example #14
0
 function dosyncToSystemPost()
 {
     global $sgbl;
     createRestartFile("djbdns");
 }
Example #15
0
 static function findTotaltrafficwebUsage($driverapp, $statsprog, $list, $oldtime, $newtime)
 {
     // run awstats only if it is today.
     global $gbl, $sgbl, $login, $ghtml;
     if ($sgbl->isDebug()) {
         if (time() - $newtime < 24 * 3600 * 2) {
             self::run_awstats($statsprog, $list);
         }
     } else {
         self::run_awstats($statsprog, $list);
     }
     if (!isset($oldtime)) {
         return null;
     }
     foreach ($list as $d) {
         $tlist[$d->nname] = self::getweb_usage($d->nname, $d->customer_name, $oldtime, $newtime, $d);
     }
     foreach ($tlist as $key => $t) {
         if (!isset($t)) {
             $t = 0;
         }
         $temp[$key] = $t;
     }
     dprintr($temp);
     createRestartFile($driverapp);
     return $temp;
 }
Example #16
0
 function createIniFile()
 {
     $pclass = $this->main->getParentClass();
     $ver = find_php_version();
     //dprintr($this->main->phpini_flag_b);
     $this->initString($ver);
     //dprintr($this->main->phpini_flag_b);
     $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}");
     $cont = lfile_get_contents("../file/phpini/php.ini.temp");
     $htcont = lfile_get_contents("../file/phpini/htaccesstemp");
     $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val");
     $l1 = $this->main->getInheritedList();
     $l2 = $this->main->getLocalList();
     $l3 = $this->main->getExtraList();
     $ll = lx_array_merge(array($l1, $l2, $l3));
     $list = array_unique($ll);
     foreach ($list as $l) {
         $vl = strtil($l, "_flag") . "_val";
         if (array_search_bool($vl, $vlist)) {
             continue;
         }
         list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l);
     }
     foreach ($vlist as $vl) {
         list($cont) = $this->replacestr(array($cont), $vl);
     }
     /*
     list($cont) = $this->replacestr(array($cont), 'enable_zend_val');
     list($cont) = $this->replacestr(array($cont), 'enable_ioncube_val');
     list($cont) = $this->replacestr(array($cont), 'enable_xcache_val');
     
     
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_global_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_compression_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'display_error_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'file_uploads_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_max_filesize');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'log_errors_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'upload_tmp_dir_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'output_buffering_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_argc_argv_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_gpc_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'variables_order_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_runtime_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'magic_quotes_sybase_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'gpc_order_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'extension_dir_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'enable_dl_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'mysql_allow_persistent_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'disable_functions_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_execution_time_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'max_input_time_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'memory_limit_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'post_max_size_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'register_long_arrays_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_fopen_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'allow_url_include_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'session_save_path_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'cgi_force_redirect_flag');
     list($cont, $htcont) = $this->replacestr(array($cont, $htcont), 'safe_mode_flag');
     */
     $stlist[] = "###Start Kloxo PHP config Area";
     $stlist[] = "###Start Lxdmin Area";
     $stlist[] = "###Start Kloxo Area";
     $stlist[] = "###Start Lxadmin PHP config Area";
     $endlist[] = "###End Kloxo PHP config Area";
     $endlist[] = "###End Kloxo Area";
     $endlist[] = "###End Lxadmin PHP config Area";
     $endstring = $endlist[0];
     $startstring = $stlist[0];
     if ($pclass === 'pserver') {
         $file = "/etc/php.ini";
         if (!lxfile_exists("__path_kloxo_back_phpini")) {
             lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini");
         }
         $this->enableDisableModule("enable_xcache_flag", "xcache");
         $htfile = null;
         $extrafile = "/etc/custom.php.ini";
         $extrastring = lfile_get_contents("/etc/custom.php.ini");
         $cont = "{$extrastring}\n{$cont}";
     } else {
         $dname = $this->main->getParentName();
         $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog";
         $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini";
         $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini";
         $extrastring = lfile_get_contents($extrafile);
         $htfile = "{$this->main->__var_docrootpath}/.htaccess";
         $ht1file = "/home/httpd/{$this->main->getParentName()}/kloxoscript/.htaccess";
         $htcont = "php_value error_log {$elogfile}\n{$htcont}";
         $htcont = "<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n";
         file_put_between_comments($stlist, $endlist, $startstring, $endstring, $htfile, $htcont);
         file_put_between_comments($stlist, $endlist, $startstring, $endstring, $ht1file, $htcont);
         lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache");
         $adminbasedir = trim($this->main->__var_extrabasedir);
         if (!$this->main->isOn('__var_disable_openbasedir')) {
             $cont = "open_basedir = /home/{$this->main->__var_customer_name}:{$adminbasedir}:/tmp:/usr/share/pear:/home/httpd/{$dname}:/var/lib/php/session:/home/kloxo/httpd/script:/home/httpd/{$dname}/kloxoscript/\n{$cont}";
         }
         $cont = "error_log = {$elogfile}\n{$cont}";
         $cont = "{$extrastring}\n{$cont}";
     }
     lxfile_rm($file);
     lfile_put_contents($file, "{$header}\n{$cont}\n");
     createRestartFile($this->main->__var_webdriver);
 }
Example #17
0
 function dbactionDelete()
 {
     global $gbl, $sgbl, $login, $ghtml;
     $this->checkForEthBase();
     $dev = explode("-", $this->main->devname);
     if (count($dev) >= 2) {
         $actualname = implode(":", $dev);
     } else {
         $actualname = $this->main->devname;
     }
     $ipaddrfile = "{$sgbl->__path_real_etc_root}/sysconfig/network-scripts/ifcfg-" . $actualname;
     lxshell_return("ifdown", $actualname);
     lxfile_rm($ipaddrfile);
     createRestartFile($this->main->__var_dnsdriver);
 }
Example #18
0
<?php

include_once "htmllib/lib/include.php";
lxfile_mv_rec("/var/tmp/graylist.d/", "/var/tmp/tmp_graylist.d");
lxfile_mkdir("/var/tmp/graylist.d/");
createRestartFile("xinetd");
lxfile_rm_rec("/var/tmp/tmp_graylist.d/");
Example #19
0
 function dosyncToSystemPost()
 {
     global $gbl, $sgbl, $login, $ghtml;
     createRestartFile("lighttpd");
 }
Example #20
0
 function dosyncToSystemPost()
 {
     global $sgbl;
     //$ret =  lxshell_return("rndc", "reload", $this->main->nname);
     $ret = 1;
     if ($ret) {
         createRestartFile("maradns");
     }
 }
Example #21
0
 function createIniFile()
 {
     $pclass = $this->main->getParentClass();
     $ver = find_php_version();
     $this->initString($ver);
     $header = lfile_get_contents("../file/phpini/php.ini.template-{$ver}");
     $cont = lfile_get_contents("../file/phpini/php.ini.temp");
     $htcont = lfile_get_contents("../file/phpini/htaccesstemp");
     $vlist = array("enable_zend_val", "enable_ioncube_val", "enable_xcache_val");
     $l1 = $this->main->getInheritedList();
     $l2 = $this->main->getLocalList();
     $l3 = $this->main->getExtraList();
     $ll = lx_array_merge(array($l1, $l2, $l3));
     $list = array_unique($ll);
     foreach ($list as $l) {
         $vl = strtil($l, "_flag") . "_val";
         if (array_search_bool($vl, $vlist)) {
             continue;
         }
         list($cont, $htcont) = $this->replacestr(array($cont, $htcont), $l);
     }
     foreach ($vlist as $vl) {
         list($cont) = $this->replacestr(array($cont), $vl);
     }
     $stlist[] = "###Start Kloxo PHP config Area";
     $stlist[] = "###Start Lxdmin Area";
     $stlist[] = "###Start Kloxo Area";
     $stlist[] = "###Start Lxadmin PHP config Area";
     $endlist[] = "###End Kloxo PHP config Area";
     $endlist[] = "###End Kloxo Area";
     $endlist[] = "###End Lxadmin PHP config Area";
     $endstring = $endlist[0];
     $startstring = $stlist[0];
     if ($pclass === 'pserver') {
         $file = "/etc/php.ini";
         if (!lxfile_exists("__path_kloxo_back_phpini")) {
             lxfile_cp("/etc/php.ini", "__path_kloxo_back_phpini");
         }
         $this->enableDisableModule("enable_xcache_flag", "xcache");
         $htfile = null;
         $extrafile = "/etc/custom.php.ini";
         if (lxfile_exists($extrafile)) {
             $extrastring = lfile_get_contents($extrafile);
             $cont = "{$extrastring}\n{$cont}";
         } else {
             $cont = "{$cont}";
         }
     } else {
         $dname = $this->main->getParentName();
         $elogfile = "/home/{$this->main->__var_customer_name}/__processed_stats/{$this->main->getParentName()}.phplog";
         $file = "__path_httpd_root/{$this->main->getParentName()}/php.ini";
         $extrafile = "__path_httpd_root/{$this->main->getParentName()}/custom.php.ini";
         if (lxfile_exists($extrafile)) {
             $extrastring = lfile_get_contents($extrafile);
         } else {
             $extrastring = "";
         }
         // ToDo #590 - disable appear on .htaccess
         // REVERT - back to enable because mod_php tend to share-based php.ini
         // and some parameters of domain specific must be declare inside .htaccess
         $htfile = "{$this->main->__var_docrootpath}/.htaccess";
         $ht1file = "/home/{$this->main->__var_customer_name}/kloxoscript/.htaccess";
         $htcont = "php_value error_log \"{$elogfile}\"\n{$htcont}";
         $htcont = str_replace("\n", "\n\t", $htcont);
         $htcont = str_replace($htcont, "\t" . $htcont, $htcont);
         $htcont = "\n<Ifmodule mod_php4.c>\n{$htcont}\n</Ifmodule>\n\n<Ifmodule mod_php5.c>\n{$htcont}\n</Ifmodule>\n";
         file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $htfile, $htcont);
         file_put_between_comments("{$this->main->__var_web_user}:apache", $stlist, $endlist, $startstring, $endstring, $ht1file, $htcont);
         lxfile_unix_chown($htfile, "{$this->main->__var_web_user}:apache");
         // MR --- set the same like AddOpenBaseDir() on web__apachelib.php
         $clname = $this->main->__var_customer_name;
         $adminbasedir = trim($this->main->__var_extrabasedir);
         if ($adminbasedir) {
             $adminbasedir .= ":";
         }
         if (!$this->main->isOn('__var_disable_openbasedir')) {
             $path = "{$adminbasedir}";
             $path .= "/home/{$clname}:";
             $path .= "/home/{$clname}/kloxoscript:";
             $path .= "/home/httpd/{$dname}:";
             $path .= "/home/httpd/{$dname}/httpdocs:";
             $path .= "/tmp:";
             $path .= "/usr/share/pear:";
             $path .= "/var/lib/php/session:";
             $path .= "/home/kloxo/httpd/script";
             $cont = "open_basedir = \"{$path}\"\n\n{$cont}";
         }
         $cont = "error_log = \"{$elogfile}\"\n{$cont}";
         $cont = "{$extrastring}\n{$cont}";
     }
     lxfile_rm($file);
     lfile_put_contents($file, "{$header}\n{$cont}\n");
     createRestartFile($this->main->__var_webdriver);
 }
Example #22
0
File: lib.php Project: zseand/kloxo
function updatecleanup()
{
    setPrepareKloxo();
    // Fixes #303 and #304
    installThirdparty();
    install_gd();
    install_bogofilter();
    setInitialPhpMyAdmin();
    setInitialAdminAccount();
    setInitialKloxoPhp();
    installWebmail();
    installAwstats();
    setRemoveOldDirs();
    setInitialBinary();
    log_cleanup("Remove lighttpd errorlog");
    log_cleanup("- Remove process");
    remove_lighttpd_error_log();
    log_cleanup("Fix the secure logfile");
    log_cleanup("- Fix process");
    call_with_flag("fix_secure_log");
    log_cleanup("Clean hosts.deny");
    log_cleanup("- Clean process");
    call_with_flag("remove_host_deny");
    log_cleanup("Turn off mouse daemon");
    log_cleanup("- Turn off process");
    system("chkconfig gpm off");
    if (lxfile_exists("phpinfo.php")) {
        log_cleanup("Remove phpinfo.php");
        log_cleanup("- Remove process");
        lxfile_rm("phpinfo.php");
    }
    setInitialBind();
    log_cleanup("Killing gettraffic system process");
    log_cleanup("- Killing process");
    lxshell_return("pkill", "-f", "gettraffic");
    setCheckPackages();
    copy_script();
    install_xcache();
    log_cleanup("Install Kloxo service");
    log_cleanup("- Install process");
    lxfile_unix_chmod("/etc/init.d/kloxo", "0755");
    system("chkconfig kloxo on");
    setJailshellSystem();
    log_cleanup("Set /home permission to 0755");
    log_cleanup("- Set process");
    lxfile_unix_chmod("/home", "0755");
    setExecuteCentos5Script();
    fix_rhn_sources_file();
    setInitialApacheConfig();
    setInitialPureftpConfig();
    setInstallMailserver();
    log_cleanup("Enable xinetd service");
    log_cleanup("- Enable process");
    call_with_flag("enable_xinetd");
    fix_suexec();
    if (!lxfile_exists("/usr/bin/php-cgi")) {
        log_cleanup("Initialize php-cgi binary");
        log_cleanup("- Initialize process");
        lxfile_cp("/usr/bin/php", "/usr/bin/php-cgi");
    }
    setSomePermissions();
    setInitialLighttpdConfig();
    setInitialNobodyScript();
    setSomeScript();
    log_cleanup("Install /etc/init.d/djbdns service file");
    log_cleanup("- Install process");
    lxfile_cp("../file/djbdns.init", "/etc/init.d/djbdns");
    removeOtherDrivers();
    log_cleanup("Remove cache dir");
    log_cleanup("- Remove process");
    lxfile_rm_rec("__path_program_root/cache");
    log_cleanup("Restart syslog service");
    log_cleanup("- Restart process");
    createRestartFile('syslog');
    log_cleanup("Initialize awstats dirdata");
    log_cleanup("- Initialize process");
    lxfile_mkdir("/home/kloxo/httpd/awstats/dirdata");
    setInitialLogrotate();
    installRoundCube();
    installHorde();
    installChooser();
    log_cleanup("Remove old lxlabs ssh key");
    log_cleanup("- Remove process");
    remove_ssh_self_host_key();
    setInitialServer();
    setDefaultPages();
    installInstallApp();
    setFreshClam();
    changeMailSoftlimit();
}