function fixlogdir_main() { global $gbl, $sgbl, $login, $ghtml; $progname = $sgbl->__var_program_name; $logl = lscandir_without_dot("../log"); lxfile_mkdir("../processed_log"); @lunlink("../log/access_log"); @lunlink("/usr/local/lxlabs/ext/php/error.log"); $dir = getNotexistingFile("../processed_log", "proccessed"); system("mv ../log ../processed_log/{$dir}"); mkdir("../log"); $list = lscandir_without_dot("../processed_log"); foreach ($list as $l) { remove_directory_if_older_than_a_day("../processed_log/{$l}", 6); } foreach ($logl as $l) { lxfile_touch("../log/{$l}"); } lxfile_generic_chown_rec("../log", "lxlabs:lxlabs"); // // Related to Issue #15 // lxfile_generic_chmod_rec("../log", "0640"); lxfile_generic_chmod_rec("../processed_log", "0640"); lxfile_generic_chmod("../log", "0700"); lxfile_generic_chmod("../processed_log", "0700"); lxfile_generic_chmod("../log/lighttpd_error.log", "0644"); lxfile_generic_chmod("../log/access_log", "0644"); lxfile_generic_chown("../log/lighttpd_error.log", "lxlabs:root"); lxfile_generic_chown("../log/access_log", "lxlabs:root"); // os_restart_program(); }
function createDir() { global $gbl, $sgbl, $login, $ghtml; if (!$this->customer_name) { log_log("critical", "Lack customername for web: {$this->nname}"); return; } $web_home = $sgbl->__path_httpd_root; $base_root = $sgbl->__path_httpd_root; $v_dir = "{$web_home}/{$this->nname}/conf"; $log_path = "{$web_home}/{$this->nname}/stats"; $cgi_path = "{$this->getFullDocRoot()}/cgi-bin/"; $log_path1 = "{$log_path}/"; $cust_log = "{$log_path1}/{$this->nname}-custom_log"; $err_log = "{$log_path1}/{$this->nname}-error_log"; $awstat_conf = "{$sgbl->__path_real_etc_root}/awstats/"; $awstat_dirdata = "{$sgbl->__path_kloxo_httpd_root}/awstats/"; $user_home = $this->getFullDocRoot(); if (!lxfile_exists("{$this->getCustomerRoot()}/public_html")) { lxfile_symlink($this->nname, "{$this->getCustomerRoot()}/public_html"); } $domname = $this->nname; /* print("+++++++++++++++++++++++++++++++++++++++++++++++++++++"); print("This is the Conf file Path $v_dir =" ); print("This is the LogPath $log_path = "); print("This is the LogPath $log_path1 ="); print("This is the Custom LogPath $cust_log =" ); print("This is the Error LoG Path $err_log = "); print("$stat_conf = "); print("This is THE User Home $user_home = "); print("+++++++++++++++++++++++++++++++++++++++++++++++++++"); */ // Protection for webstats. /* $new_user_dir = false; lxfile_mkdir($user_home); if ((count(lscandir_without_dot($user_home)) == 0) && isset($this->__var_skelfile) && $this->__var_skelfile) { $this->getAndUnzipSkeleton($this->__var_skelmachine, $this->__var_skelfile, "$user_home/"); $new_user_dir = true; } lxfile_mkdir("$web_home/$domname/webstats"); */ $wsstring = "Stats not yet generated\n"; lfile_put_contents("{$web_home}/{$domname}/webstats/index.html", $wsstring); lxfile_mkdir($cgi_path); lxfile_mkdir($user_home); // Sort of hack.. Changes the domain.com/domain.com to domain.com/httpdocs. // Which is easier to remember. Slowly we need to change all the code from dom/dom to dom/httpdocs.. // but for now, just create a symlink. lxfile_generic_chmod("{$web_home}/{$this->nname}", "0755"); lxfile_mkdir("{$user_home}/"); lxfile_generic_chmod($user_home, "0755"); lxfile_mkdir($v_dir); lxfile_mkdir($log_path); //lxfile_mkdir($log_path1); // issue #589 - Change httpd config structure // lxfile_mkdir("__path_apache_path/kloxo"); // lxfile_touch("__path_apache_path/kloxo/virtualhost.conf"); $parent_doc_root = $this->getParentFullDocRoot(); if ($user_home != $parent_doc_root) { lxfile_generic_chown_rec($parent_doc_root, "{$this->username}:{$this->username}"); } else { lxfile_generic_chown_rec($user_home, "{$this->username}:{$this->username}"); } /* // Issue #565 - Domain skeleton files chmodded to 0755 // latest info from William if ($new_user_dir) { lxfile_generic_chmod_rec($user_home, "755"); } system("find {$user_home} -type f -exec chmod 644 {} \;"); system("find {$user_home} -type d -exec chmod 755 {} \;"); */ // MR --- consistence with fix-chownchmod script // fixed 64bit slave (skeleton.zip always zero) // back to original because problem with suphp lxfile_generic_chown($user_home, "{$this->username}:apache"); lxfile_generic_chown("__path_customer_root/{$this->customer_name}", "{$this->username}:apache"); lxfile_generic_chmod("__path_customer_root/{$this->customer_name}", "750"); lxfile_generic_chown($log_path1, "apache:apache"); lxfile_generic_chmod($log_path1, "770"); lxfile_generic_chown("{$web_home}/{$this->nname}", "{$this->username}:apache"); if (!lxfile_exists("{$web_home}/{$this->nname}/httpdocs")) { //lxfile_mkdir("$sgbl->__path_customer_root/$this->customer_name/domain/$this->nname"); //lxfile_symlink("{$this->getFullDocRoot()}", "$sgbl->__path_customer_root/$this->customer_name/domain/$this->nname/www"); lxfile_symlink("{$this->getFullDocRoot()}", "{$web_home}/{$this->nname}/httpdocs"); //lxfile_symlink("$web_home/{$this->nname}/httpdocs", "$web_home/{$this->nname}/{$this->nname}"); } $this->createstatsConf($this->nname, $this->stats_username, $this->stats_password); /* print("This is the User Home : $user_home \n"); print("This is the certificate Pah : $sgbl->__path_ssl_root/certificate/\n"); print("This is the Private Key Pah: $sgbl->__path_ssl_root/privatekey/\n"); print("This is the Domain Name :$web_home/{$this->nname}\n"); print( "This is teh User Httpdocs :$user_home/www/"); print("GO to the User Dir (chmod 775"); print("Chown To The :{$this->username}:{$this->username}, $user_home\n"); print("This is the Vdir : $v_dir\n"); print("Creating log path :$log_path\n"); print("Creating Dir:$log_path1\n"); print("Touching :$sgbl->__path_apache_path/kloxo\n"); print("Touching Virtual hOPs$sgbl->__path_apache_path/kloxo/virtualhost.conf\n"); print("$err_log\n"); print("Install ALL : $install_all\n"); print("chown :{$this->username} , $web_home/{$this->nname}\n"); exit; */ // MR -- make guarantee the last process! // mod_php still possible not work (ftp issue) for tranfer skeleton.zip from master to slave $this->getAndUnzipSkeleton($this->__var_skelmachine, $this->__var_skelfile, "{$user_home}/"); dprint("end\n"); }
function do_restore($docd) { global $gbl, $sgbl, $login, $ghtml; $name = $this->main->getPathFromName('nname'); $fullpath = "{$sgbl->__path_customer_root}/{$name}/"; lxfile_mkdir($fullpath); lxshell_unzip_with_throw($fullpath, $docd); lxfile_generic_chown_rec($fullpath, "{$this->main->username}:{$this->main->username}"); lxfile_generic_chown($fullpath, "{$this->main->username}:apache"); lxfile_generic_chmod($fullpath, "0750"); }
function installHorde() { global $sgbl; $path_webmail = "{$sgbl->__path_kloxo_httpd_root}/webmail"; $path_horde = "{$sgbl->__path_kloxo_httpd_root}/webmail/horde"; PrepareHordeDb(); log_cleanup("Initialize Horde files"); log_cleanup("- Initialize process"); if (lxfile_exists($path_webmail)) { lxfile_generic_chown_rec($path_webmail, 'lxlabs:lxlabs'); lxfile_generic_chown_rec("{$path_horde}/logs", 'apache:apache'); lxfile_generic_chown_rec("{$path_horde}/temp", 'apache:apache'); lxfile_rm('/var/cache/kloxo/horde.log'); } }
static function getFromRemote($user, $server, $filepass, $dt, $p) { getFromRemote($server, $filepass, $dt, $p); lxfile_generic_chown_rec("{$dt}/{$p}", $user); }