Example #1
0
function update_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    debug_for_backend();
    $program = $sgbl->__var_program_name;
    $login = new Client(null, null, 'upgrade');
    $opt = parse_opt($argv);
    print "Getting Version Info from the Server...\n";
    if (isset($opt['till-version']) && $opt['till-version'] || lxfile_exists("__path_slave_db")) {
        $sgbl->slave = true;
        $upversion = findNextVersion($opt['till-version']);
        $type = 'slave';
    } else {
        $sgbl->slave = false;
        $upversion = findNextVersion();
        $type = 'master';
    }
    print "Connecting... Please wait....\n";
    if ($upversion) {
        do_upgrade($upversion);
        print "Upgrade Done.. Executing Cleanup....\n";
        flush();
    } else {
        print "{$program} is the latest version\n";
    }
    if (is_running_secondary()) {
        print "Not running Update Cleanup, because this is running secondary \n";
        exit;
    }
    lxfile_cp("htmllib/filecore/php.ini", "/usr/local/lxlabs/ext/php/etc/php.ini");
    $res = pcntl_exec("/bin/sh", array("../bin/common/updatecleanup.sh", "--type={$type}"));
    print "Done......\n";
}
Example #2
0
 static function initThisListRule($parent, $class)
 {
     $listvar = "{$class}_l";
     $ret = array();
     if (!empty($parent)) {
         $parent->checkChildExists($class);
         $ret[] = array('parent_clname', '=', "'{$parent->getClName()}'");
     } else {
         dprint('Warning ' . $class . ' have a missing parent<br />');
         debug_for_backend();
     }
     return $ret;
 }
Example #3
0
<?php

include_once "htmllib/lib/include.php";
include_once "htmllib/lib/lxguardincludelib.php";
$global_dontlogshell = true;
exit_if_secondary_master();
exit_if_another_instance_running();
debug_for_backend();
watchdog__sync::watchRun();
if ($sgbl->is_this_master()) {
    $gbl->is_master = true;
    initProgram('admin');
    run_mail_to_ticket();
}
monitor_load();
collect_traffic();
lxguard_main();
add_to_log("/var/log/kloxo/smtp.log");
add_to_log("/var/log/kloxo/courier");
function collect_traffic()
{
    $flfile = "__path_program_etc/last_sisinfoc";
    $ret = lfile_get_unserialize($flfile);
    $interval = 20 * 60;
    //$interval = 2;
    if (time() - $ret['time'] < $interval) {
        //return;
    }
    $oldtime = $ret['time'];
    //if (!$oldtime) { $oldtime = time() - 20 * 60 ; }
    if (!$oldtime) {
Example #4
0
function update_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    debug_for_backend();
    $prognameNice = $sgbl->__var_program_name_nice;
    $login = new Client(null, null, 'upgrade');
    $opt = parse_opt($argv);
    print "Getting Version Info from the Server...\n";
    print "Connecting... Please wait....\n";
    if (isset($opt['till-version']) && $opt['till-version'] || lxfile_exists("__path_slave_db")) {
        $sgbl->slave = true;
        $upversion = findNextVersion($opt['till-version']);
        $type = 'slave';
    } else {
        $sgbl->slave = false;
        $upversion = findNextVersion();
        $type = 'master';
    }
    $thisversion = $sgbl->__ver_major_minor_release;
    if ($upversion) {
        do_upgrade($upversion);
        print "Upgrade Done!\nStarting the Cleanup.\n";
        flush();
    } else {
        print "{$prognameNice} is the latest version ({$thisversion})\n";
        print "Run 'sh /script/cleanup' if you want restore/fix possible issues.\n";
        exit;
    }
    if (is_running_secondary()) {
        print "Not running the Update Cleanup, because this server is a secondary.\n";
        exit;
    }
    // Needs to be here. So any php.ini change takes immediately effect.
    print "Copy Core PHP.ini\n";
    lxfile_cp("htmllib/filecore/php.ini", "/usr/local/lxlabs/ext/php/etc/php.ini");
    pcntl_exec("/bin/sh", array("../bin/common/updatecleanup-core.sh", "--type={$type}"));
    print "{$prognameNice} is Ready!\n\n";
}
Example #5
0
function update_main()
{
    global $argc, $argv;
    global $gbl, $sgbl, $login, $ghtml;
    log_cleanup("*** Executing Update (upcp) - BEGIN ***");
    debug_for_backend();
    $login = new Client(null, null, 'upgrade');
    $DoUpdate = false;
    $opt = parse_opt($argv);
    log_cleanup("Kloxo Install/Update");
    if (lxfile_exists("/var/cache/kloxo/kloxo-install-firsttime.flg")) {
        log_cleanup("- Installing Kloxo packages at the first time");
        $DoUpdate = true;
    } else {
        log_cleanup("- Getting Version Info from the LxCenter download Server");
        $upversion = false;
        if (isset($opt['till-version']) && $opt['till-version'] || lxfile_exists("__path_slave_db")) {
            $sgbl->slave = true;
            $upversion = findNextVersion($opt['till-version']);
            $type = 'slave';
        } else {
            $sgbl->slave = false;
            $upversion = findNextVersion();
            $type = 'master';
        }
        if ($upversion) {
            log_cleanup("- Connecting LxCenter download server");
            do_upgrade($upversion);
            log_cleanup("- Upgrade Done. Cleanup....");
            flush();
        } else {
            $localversion = $sgbl->__ver_major_minor_release;
            log_cleanup("- Kloxo is the latest version ({$localversion})");
        }
        // Thirdparty/Webmail/AWstats checks
        $verWM = getVersionNumber(get_package_version("lxwebmail"));
        $verAW = getVersionNumber(get_package_version("lxawstats"));
        $ver = file_get_contents("http://download.lxcenter.org/download/thirdparty/kloxo-version.list");
        $verTP = getVersionNumber($ver);
        if (!lxfile_exists("/var/cache/kloxo/lxwebmail{$verWM}.tar.gz")) {
            $retWM = true;
        } else {
            $retWM = false;
        }
        if (!lxfile_exists("/var/cache/kloxo/lxawstats{$verAW}.tar.gz")) {
            $retAW = true;
        } else {
            $retAW = false;
        }
        if (!lxfile_exists("/var/cache/kloxo/kloxo-thirdparty.{$verTP}.zip")) {
            $retTP = true;
        } else {
            $retTP = false;
        }
        installThirdparty();
        installWebmail();
        installAwstats();
        // Run cleanups or not
        if ($retTP || $retWM || $retAW || $upversion) {
            $DoUpdate = true;
        } else {
            $DoUpdate = false;
        }
    }
    log_cleanup("*** Executing Update (upcp) - END ***");
    if ($DoUpdate == false) {
        log_cleanup("Run /script/cleanup if you want to fix/restore/(re)install non-working components.");
        exit;
    }
    if (is_running_secondary()) {
        log_cleanup("Not running Update cleanup, because this is running as secondary\n");
        exit;
    }
    //
    // Executing update/cleanup process
    //
    lxfile_cp("htmllib/filecore/php.ini", "/usr/local/lxlabs/ext/php/etc/php.ini");
    $res = pcntl_exec("/bin/sh", array("../bin/common/updatecleanup.sh", "--type={$type}"));
}