Exemple #1
0
function doBeforeUpdate()
{
    global $gbl, $sgbl, $login, $ghtml;
    $program = $sgbl->__var_program_name;
    // Cleanup old lxlabs.repo file
    print "Fixing Repo's\n";
    $oldRepoFile = "/etc/yum.repos.d/lxlabs.repo";
    if (lxfile_exists("/etc/yum.repos.d/lxcenter.repo")) {
        if (lxfile_exists($oldRepoFile)) {
            lxfile_mv($oldRepoFile, $oldRepoFile . ".lxsave");
            lxfile_rm($oldRepoFile);
        }
    }
    // Install yum-plugin-replace (New since HyperVM 2.1.0)
    $ret = install_if_package_not_exist("yum-plugin-replace");
    if ($ret) {
        print "Installed RPM package yum-plugin-replace\n";
    }
    // Replace lxphp package (New since HyperVM 2.1.0)
    $ret = replace_rpm_package("lxphp", "hypervm-core-php");
    if ($ret) {
        print "Replaced RPM package lxphp with hypervm-core-php\n";
    }
    // Remove not used dirs/files
    if (lxfile_exists("__path_program_htmlbase/help")) {
        lxfile_rm_rec("__path_program_htmlbase/help");
    }
    // ToDo: Add here new database flag - DT
    // issue at github
}
Exemple #2
0
function doBeforeUpdate()
{
    global $gbl, $sgbl, $login, $ghtml;
    $program = $sgbl->__var_program_name;
    // 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");
    }
    // Project issue #1079
    // Install yum-plugin-replace (New since Kloxo 6.1.14)
    $ret = install_if_package_not_exist("yum-plugin-replace");
    if ($ret) {
        print "Installed RPM package yum-plugin-replace\n";
    }
    // Project issue #1079
    // Replace lxphp package (New since Kloxo 6.1.14)
    $ret = replace_rpm_package("lxphp", "kloxo-core-php");
    if ($ret) {
        print "Replaced RPM package lxphp with kloxo-core-php\n";
    }
    // 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");
    }
    // Project issue #1081
    // Remove lxrestart
    if (lxfile_exists("/usr/sbin/lxrestart")) {
        log_cleanup("- Deleting lxrestart from /usr/sbin/ (not in use anymore)");
        lxfile_rm('/usr/sbin/lxrestart');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/cexe/lxrestart')) {
        log_cleanup("- Deleting lxrestart from cexe (not in use anymore)");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/cexe/lxrestart');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/lxrestart.c')) {
        log_cleanup("- Deleting lxrestart.c from src (not in use anymore)");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/lxrestart.c');
    }
    // Clean Source dir
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/lxrestart')) {
        log_cleanup("- Clean the sources dir - remove lxrestart");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/lxrestart');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/closeallinput')) {
        log_cleanup("- Clean the sources dir - remove closeallinput");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/closeallinput');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/lxexec')) {
        log_cleanup("- Clean the sources dir - remove lxexec");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/lxexec');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/lxphpsu')) {
        log_cleanup("- Clean the sources dir - remove lxphpsu");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/lxphpsu');
    }
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/src/lxsuexec')) {
        log_cleanup("- Clean the sources dir - remove lxsuexec");
        lxfile_rm('/usr/local/lxlabs/' . $program . '/src/lxsuexec');
    }
    // DT18022014 - Cleanup the mess.
    if (lxfile_exists('/usr/local/lxlabs/' . $program . '/httpdocs/live/common.php')) {
        log_cleanup("- Remove live dir (not in use)");
        lxfile_rm_rec('/usr/local/lxlabs/' . $program . '/httpdocs/live');
        lxfile_rm('/usr/local/lxlabs/' . $program . '/etc/phplive.db');
    }
}