function fileRealDelete() { foreach ($this->main->filerealdelete_list as $f) { if (!$f) { continue; } $fullname = "{$this->main->root}/{$f}"; lxfile_rm_rec($fullname); } }
static function installMe() { lxshell_return("yum", "-y", "install", "djbdns", "daemontools"); if ($ret) { throw new lxexception('install_djbdns_failed', 'parent'); } lxfile_rm_rec("/var/tinydns"); lxfile_rm_rec("/var/axfrdns"); lxshell_return("__path_php_path", "../bin/misc/djbdnsstart.php"); lxfile_cp("../file/djbdns.init", "/etc/init.d/djbdns"); lxfile_unix_chmod("/etc/init.d/djbdns", "0755"); lxshell_return("chkconfig", "djbdns", "on"); createRestartFile("djbdns"); }
function installapp_data_update() { print fill_string("Fetch current InstallApp version", 50); $string = file_get_contents("http://download.lxcenter.org/download/installapp/version.list"); $rmt = unserialize($string); if (!$rmt) { throw new lxexception(" could_not_get_application_version_list", '', ""); } print " OK "; $remver = $rmt->applist['installapp']; print "version is {$remver}\n"; if (lxfile_exists("/home/kloxo/httpd/installappdata")) { print fill_string("Fetch local InstallApp version", 50); $loc = get_local_application_version_list(); $locver = $loc->applist['installapp']; print " OK version is {$locver}\n"; if ($remver != $locver) { print fill_string("New installapp found", 50); print " OK\n"; } } print fill_string("Checking for old installappdata.zip", 50); if (lxfile_exists("/tmp/installappdata.zip")) { lxfile_rm("/tmp/installappdata.zip"); } print " OK\n"; print fill_string("Downloading InstallApp data...", 50); system("cd /tmp ; wget -q http://download.lxcenter.org/download/installapp/installappdata.zip"); if (!lxfile_exists("/tmp/installappdata.zip")) { print " ERROR\n"; print "Could not download data from LxCenter.\nAborted.\n\n"; return; } print " OK\n"; print fill_string("Remove old InstallApp data", 50); // lxfile_rm_rec("__path_kloxo_httpd_root/installappdata"); // lxfile_mkdir("__path_kloxo_httpd_root/installappdata"); lxfile_rm_rec("/home/kloxo/httpd/installappdata"); lxfile_mkdir("/home/kloxo/httpd/installapp"); lxfile_mkdir("/home/kloxo/httpd/installappdata"); print " OK\n"; print fill_string("Unpack new InstallApp data", 50); // lxshell_unzip("lxlabs", "__path_kloxo_httpd_root/installappdata/", "/tmp/installappdata.zip"); system("cd /home/kloxo/httpd/installappdata ; unzip -qq /tmp/installappdata.zip"); print " OK\n"; print fill_string("Remove downloaded InstallApp data zip file", 50); lxfile_rm("/tmp/installappdata.zip"); print " OK\n"; }
function do_upgrade($upversion) { global $gbl, $sgbl, $login, $ghtml; if (file_exists("/usr/local/lxlabs/.git")) { print "Development system.. Not upgrading --> exit!...\n"; exit; } $program = $sgbl->__var_program_name; $programfile = "{$program}-" . $upversion . ".zip"; lxfile_rm_rec("__path_program_htmlbase/htmllib/script"); lxfile_rm_rec("__path_program_root/pscript"); $saveddir = getcwd(); lxfile_rm_rec("__path_program_htmlbase/download"); lxfile_mkdir("download"); chdir("download"); print "Downloading {$programfile}.....\n"; download_source("/{$program}/{$programfile}"); print "Download Done....\n"; lxshell_unzip("../..", $programfile); chdir($saveddir); }
public function setInternalParam($mountpoint) { $name = $this->main->ostemplate; if ($this->main->isWindows()) { return; } if (!$mountpoint) { return; } if ($name === 'unknown') { return; } $name = strtolower($name); $mountpoint = expand_real_root($mountpoint); $result = $this->getScriptS($name); dprint("Distro Name {$name}, Scripts: \n"); dprintr($result); $init = strtilfirst($name, "-"); dprint("File is {$init}.inittab\n"); if (lxfile_exists("../file/sysfile/inittab/{$init}.inittab")) { dprint("Copying {$init}.inittab\n"); $content = lfile_get_contents("../file/sysfile/inittab/{$init}.inittab"); if ($this->main->text_inittab) { $content .= "\n{$this->main->text_inittab}"; } lfile_put_contents("{$mountpoint}/etc/inittab", $content); } $iplist = get_namelist_from_objectlist($this->main->vmipaddress_a); if ($this->main->mainipaddress) { $main_ip = $this->main->mainipaddress; $iplist = array_remove($iplist, $main_ip); } else { $main_ip = array_shift($iplist); } if ($this->main->networknetmask) { $main_netmask = $this->main->networknetmask; } else { $main_netmask = "255.255.255.0"; } $iplist = implode(" ", $iplist); $ipadd = $result['ADD_IP']; $sethostname = $result['SET_HOSTNAME']; $setuserpass = $result['SET_USERPASS']; $ipdel = $result['DEL_IP']; if ($this->main->networkgateway) { $gw = $this->main->networkgateway; } else { $gw = os_get_network_gateway(); } $gwn = strtil($gw, '.') . '.0'; $hostname = $this->main->hostname; if (!$hostname) { $hostname = os_get_hostname(); } if ($result['STARTUP_SCRIPT'] != 'systemd') { $name = createTempDir("{$mountpoint}/tmp", 'xen-scripts'); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $name); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $name); $basepath = strfrom($name, $mountpoint); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\nsource /{$basepath}/{$ipdel}\n"); $delipstring = "IPDELALL=yes chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($delipstring); log_shell(system($delipstring, $ret1) . ":return {$ret1}"); putenv("VE_STATE=stopped"); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$ipadd}\n"); $string = "IPDELALL=yes MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string, $ret1) . ":return {$ret1}"); lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$sethostname}\n"); $string = "HOSTNM={$hostname} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string, $ret1) . ":return {$ret1}"); if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) { $rootpass = "******"; lfile_put_contents("{$name}/tmpfile.sh", "source /{$basepath}/functions\n source /{$basepath}/{$setuserpass}\n"); $string = "USERPW={$rootpass} chroot {$mountpoint} bash /{$basepath}/tmpfile.sh"; log_shell($string); log_shell(system($string)); } lxfile_rm_rec($name); } else { if ($result['STARTUP_SCRIPT'] == 'systemd') { $script_dir = createTempDir("{$mountpoint}", "hypervm-runonce"); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/functions", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipadd}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$sethostname}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$setuserpass}", $script_dir); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$ipdel}", $script_dir); $basepath = strfrom($script_dir, $mountpoint); $startupdir = 'lib/systemd/system'; $startupscript = 'fedora-startup.service'; $setrootpass = ''; if ($this->main->subaction === 'rebuild' || $this->main->dbaction === 'add' || $this->main->isOn('__var_rootpassword_changed') && $this->main->rootpassword) { $rootpass = "******"; $setrootpass = "******"; } $run_once_script = "#!/bin/bash\n" . "source {$basepath}/functions\n" . '(' . "IPDELALL=yes source {$basepath}/{$ipdel}" . " & IPDELALL=yes VE_STATE=stopped MAIN_NETMASK={$main_netmask} MAIN_IP_ADDRESS={$main_ip} IP_ADDR=\"{$iplist}\" NETWORK_GATEWAY={$gw} NETWORK_GATEWAY_NET={$gwn} source {$basepath}/{$ipadd}" . " & HOSTNM={$hostname} source {$basepath}/{$sethostname}" . "{$setrootpass})\n" . "service fedora-startup disable\nrm -f /{$startupdir}/{$startupscript}\nrm -rf {$basepath}"; lfile_put_contents("{$script_dir}/hypervm-runonce.sh", $run_once_script); lxfile_cp_rec("__path_program_root/bin/xen-dists/scripts/{$startupscript}", "{$mountpoint}/{$startupdir}"); lfile_put_contents("{$mountpoint}/{$startupdir}/{$startupscript}", lfile_get_contents("{$mountpoint}/{$startupdir}/{$startupscript}") . "ExecStart={$basepath}/hypervm-runonce.sh\n"); system("ln -s /lib/systemd/system/fedora-startup.service {$mountpoint}/etc/systemd/system/multi-user.target.wants/fedora-startup.service"); system("chmod 755 {$script_dir}/hypervm-runonce.sh"); } } if ($this->main->nameserver) { $nlist = explode(" ", $this->main->nameserver); $nstring = null; foreach ($nlist as $l) { $nstring .= "nameserver {$l}\n"; } lfile_put_contents("{$mountpoint}/etc/resolv.conf", $nstring); } if ($this->main->timezone) { lxfile_rm("{$mountpoint}/etc/localtime"); $cmdstring = "ln -sf ../usr/share/zoneinfo/{$this->main->timezone} {$mountpoint}/etc/localtime"; log_log("localtime", $cmdstring); do_exec_system('__system__', "/", $cmdstring, $out, $err, $ret, null); //lxfile_cp("/usr/share/zoneinfo/{$this->main->timezone}", "$mountpoint/etc/localtime"); } lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0"); lunlink("{$mountpoint}/etc/sysconfig/network-scripts/ifcfg-venet0:0"); $this->main->doKloxoInit($mountpoint); }
function recursively_remove($directory) { $directory = trim($directory); if ($directory[strlen($directory) - 1] === '/') { $string = "{$directory}: Directory ends in a slash. Will not recursively delete"; dprint(' <br> ' . $string . "<br> "); log_shell_error($string); return; } lxfile_rm_rec($directory); }
function do_upgrade($upversion) { global $gbl, $sgbl, $login, $ghtml; $program = $sgbl->__var_program_name; if (file_exists(".svn") || file_exists(".git")) { log_cleanup("BREAK -> Development version found"); exit; } $programfile = "{$program}-" . $upversion . ".zip"; lxfile_rm_rec("__path_program_htmlbase/help"); lxfile_mkdir("help"); lxfile_rm_rec("__path_program_htmlbase/htmllib/script"); lxfile_rm_rec("__path_program_root/pscript"); $saveddir = getcwd(); lxfile_rm_rec("__path_program_htmlbase/download"); lxfile_mkdir("download"); chdir("download"); log_cleanup("Downloading {$programfile}"); download_source("/{$program}/{$programfile}"); log_cleanup("Download Done!... Start unzip"); system("cd ../../ ; unzip -o httpdocs/download/{$programfile}"); // issue #710 - Make sure the files are owned by lxlabs UID/GID system("chown -R lxlabs:lxlabs /usr/local/lxlabs/"); chdir($saveddir); }
static function switchProgramPre($old, $new) { if ($new === 'bind') { lxshell_return("service", "djbdns", "stop"); $ret = lxshell_return("yum", "-y", "install", "bind", "bind-chroot"); if ($ret) { throw new lxexception('install_bind_failed', 'parent'); } lxshell_return("chkconfig", "named", "on"); $pattern = 'include "/etc/kloxo.named.conf";'; $file = "/var/named/chroot/etc/named.conf"; $comment = "//Kloxo"; addLineIfNotExistInside($file, $pattern, $comment); touch("/var/named/chroot/etc/kloxo.named.conf"); chown("/var/named/chroot/etc/kloxo.named.conf", "named"); lxshell_return("rpm", "-e", "djbdns"); lunlink("/etc/init.d/djbdns"); } else { lxshell_return("yum", "-y", "install", "djbdns", "daemontools-toaster"); if ($ret) { throw new lxexception('install_djbdns_failed', 'parent'); } lxshell_return("service", "named", "stop"); lxfile_rm_rec("/var/tinydns"); lxfile_rm_rec("/var/axfrdns"); lxshell_return("__path_php_path", "../bin/misc/djbdnsstart.php"); lxshell_return("rpm", "-e", "--nodeps", "bind"); lxshell_return("rpm", "-e", "--nodeps", "bind-chroot"); lxfile_cp("../file/djbdns.init", "/etc/init.d/djbdns"); lxfile_unix_chmod("/etc/init.d/djbdns", "0755"); lxshell_return("chkconfig", "djbdns", "on"); } }
cp_rec_if_not_exists("/usr/lib/lxadminphp/", "/usr/lib/kloxophp"); cp_rec_if_not_exists("/var/tinydns/root/lxadmin", "/var/tinydns/root/kloxo"); lxfile_mkdir("/var/log/kloxo"); change_lxadmin_to_kloxo("/etc/syslog.conf"); change_lxadmin_to_kloxo("/etc/init.d/courier-imap"); change_lxadmin_to_kloxo("/usr/bin/lxredirecter.sh"); change_lxadmin_to_kloxo("/etc/xinetd.d/pureftp"); change_lxadmin_to_kloxo_directory("/etc/awstats/"); lxfile_mkdir("/home/kloxo"); mv_rec_if_not_exists("/home/lxadmin/httpd/", "/home/kloxo/httpd/"); cp_rec_if_not_exists("/home/lxadmin/lxguard/", "/home/kloxo/lxguard/"); mv_rec_if_not_exists("/home/lxadmin/client", "/home/kloxo/client"); mv_rec_if_not_exists("/home/lxadmin/domain", "/home/kloxo/domain"); cp_rec_if_not_exists("/home/lxadmin/selfbackup", "/home/kloxo/selfbackup"); lxfile_rm_rec("/usr/local/lxlabs/kloxo/httpdocs/img/custom/"); lxfile_rm_rec("/usr/local/lxlabs/kloxo/httpdocs/img/logo/"); cp_rec_if_not_exists("/usr/local/lxlabs/lxadmin/httpdocs/img/custom", "/usr/local/lxlabs/kloxo/httpdocs/img/custom"); cp_rec_if_not_exists("/usr/local/lxlabs/lxadmin/httpdocs/img/logo", "/usr/local/lxlabs/kloxo/httpdocs/img/logo"); change_http_dir(); change_lighty(); change_dns(); passthru("lphp.exe ../bin/common/tmpupdatecleanup.php"); function change_http_dir() { $list = lscandir_without_dot_or_underscore("/home/httpd/"); foreach ($list as $l) { cp_rec_if_not_exists("/home/httpd/{$l}/lxadminscript", "/home/httpd/{$l}/kloxoscript"); change_lxadmin_to_kloxo("/home/httpd/{$l}/kloxoscript/phpinfo.php"); cp_rec_if_not_exists("/home/httpd/{$l}/conf/lxadmin.{$l}", "/home/httpd/{$l}/conf/kloxo.{$l}"); change_lxadmin_to_kloxo("/home/httpd/{$l}/conf/kloxo.{$l}"); change_lxadmin_to_kloxo("/home/httpd/{$l}/php.ini");
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(); }
function dbActiondelete() { $apppath = "/home/{$this->main->customer_name}/ror/{$this->main->getParentName()}/{$this->main->appname}/"; lxfile_rm_rec($apppath); }
function dbactionDelete() { lxfile_rm_rec("__path_client_root/{$this->main->nname}"); lxfile_rm_rec("__path_customer_root/{$this->main->getPathFromName()}"); lxshell_return("userdel", $this->main->username); }
static function getMetaData($file) { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; if (!lxfile_exists($file)) { throw new lxException('could_not_find_file', '', $file); } $tmpdir = lxbackup::createTmpDirIfitDoesntExist($file, false); print_time("create_tmp_dir", "Creating Tmp Directory"); $filename = recursively_get_file($tmpdir, "{$progname}.file"); // KLoxo has to recognize lxadmin's backup file. if (!$filename && $sgbl->isKloxoForRestore()) { $filename = recursively_get_file($tmpdir, "lxadmin.file"); } $rem = unserialize(file_get_contents($filename)); $bugfix = $tmpdir . $progname . ".file"; lxfile_rm($bugfix); $bugfix = $tmpdir . $progname . ".metadata"; lxfile_rm($bugfix); lxfile_tmp_rm_rec($tmpdir); lxfile_rm_rec($tmpdir); if (!$rem) { throw new lxException('backupfile_corrupted', ''); } return $rem; }
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'); } }
function deleteDir() { global $gbl, $sgbl, $login, $ghtml; if (!$this->customer_name) { return; } if (!$this->nname) { return; } recursively_remove("{$sgbl->__path_customer_root}/{$this->customer_name}/__processed_stats/{$this->nname}"); recursively_remove("{$sgbl->__path_program_home}/domain/{$this->nname}"); recursively_remove("{$sgbl->__path_httpd_root}/{$this->nname}"); recursively_remove("{$sgbl->__path_kloxo_httpd_root}/awstats/dirdata/{$this->nname}"); lxfile_rm("__path_real_etc_root/awstats/awstats.{$this->nname}.conf"); lxfile_rm_rec("/var/lib/webalizer/{$this->nname}"); lxfile_rm("/etc/webalizer/webalizer.{$this->nname}.conf"); }
<?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/");
$pass = slave_get_db_pass(); $res = mysql_connect("localhost", "root", $pass); if (!$res) { print "Could not connect to MySQL as root. Please login via webinterface, go to admin home -> reset mysql password and reset the password and run this again.\n"; exit; } } lxshell_return("service", "lxadmin", "stop"); lxshell_return("chkconfig", "lxadmin", "off"); lxfile_rm("/etc/init.d/lxadmin"); lxfile_mkdir("/usr/local/lxlabs/kloxo"); chdir("/usr/local/lxlabs/kloxo/"); lxfile_rm("kloxo-current.zip"); system("wget http://download.lxcenter.org/download/kloxo/production/kloxo/kloxo-current.zip"); system("unzip -oq kloxo-current.zip"); lxfile_rm_rec("/usr/local/lxlabs/kloxo/etc/"); lxfile_cp_rec("/usr/local/lxlabs/lxadmin/etc/", "/usr/local/lxlabs/kloxo/etc/"); if (!$sgbl->is_this_slave()) { system("service mysqld stop"); if (!lxfile_exists("/var/lib/mysql/kloxo/")) { lxfile_cp_rec("/var/lib/mysql/lxadmin4_2", "/var/lib/mysql/kloxo"); } lxfile_unix_chown_rec("/var/lib/mysql/kloxo", "mysql:mysql"); system("service mysqld start"); sleep(10); chdir("/usr/local/lxlabs/lxadmin/httpdocs/"); passthru("lphp.exe ../bin/kloxo-db.php"); } lxfile_cp("/usr/local/lxlabs/kloxo/httpdocs/htmllib/filecore/init.program", "/etc/init.d/kloxo"); lxfile_cp("/usr/local/lxlabs/lxadmin/etc/conf/lxadmin.pass", "/usr/local/lxlabs/kloxo/etc/conf/kloxo.pass"); lxfile_unix_chmod("/etc/init.d/kloxo", "0755");