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}")); }
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(); }