Beispiel #1
0
function move_clients_to_client()
{
    if (lxfile_exists("__path_program_home/client")) {
        return;
    }
    print "Rename clients folder to client\n";
    lxfile_mv_rec("__path_program_home/clients", "__path_program_home/client");
}
Beispiel #2
0
function move_clients_to_client()
{
    if (lxfile_exists("__path_program_home/client")) {
        return false;
    }
    lxfile_mv_rec("__path_program_home/clients", "__path_program_home/client");
    return true;
}
Beispiel #3
0
function mv_rec_if_not_exists($src, $dst)
{
    if (lxfile_exists($dst)) {
        return;
    }
    if (!lxfile_exists($src)) {
        return;
    }
    lxfile_mv_rec($src, $dst);
}
Beispiel #4
0
 public function copyKernelModules()
 {
     $mountpoint = $this->mount_this_guy();
     $kernev = trim(`uname -r`);
     if (!lxfile_exists("{$mountpoint}/lib/modules/{$kernev}")) {
         lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$kernev}");
     }
     if (char_search_end($kernev, "-xen")) {
         $nkernev = strtil($kernev, "-xen");
         if (!lxfile_exists("{$mountpoint}/lib/modules/{$nkernev}")) {
             lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$nkernev}");
         }
     }
     if (char_search_beg($this->main->ostemplate, "centos-")) {
         if (lxfile_exists("{$mountpoint}/lib/tls")) {
             lxfile_rm_rec("{$mountpoint}/lib/tls.disabled");
             lxfile_mv_rec("{$mountpoint}/lib/tls", "{$mountpoint}/lib/tls.disabled");
         }
     }
 }
Beispiel #5
0
<?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/");
 function dbactionUpdate($subaction)
 {
     if_demo_throw_exception('ffile');
     if ($this->main->isOn('readonly')) {
         throw new lxexception('file_manager_is_readonly', '');
     }
     switch ($subaction) {
         case "edit":
             lfile_put_contents($this->main->getFullPath(), $this->main->content);
             break;
         case "upload":
             $filename = $this->main->getFullPath() . "/{$this->main->upload_file_name}";
             dprintr($this->main->upload_overwrite_f);
             if (!$this->main->isOn('upload_overwrite_f')) {
                 if (lfile_exists($filename)) {
                     throw new lxexception('file_exists_upload', 'upload_name_f');
                 }
             }
             getFromFileserv($this->main->__var_upload_tmp_server, $this->main->__var_upload_filepass, $filename);
             break;
         case "rename":
             $directory = dirname($this->main->fullpath);
             $new = $directory . "/" . $this->main->newname;
             if (lfile_exists($new)) {
                 throw new lxexception('file_exists_rename', '');
             }
             lxfile_mv_rec($this->main->fullpath, $new);
             //lxfile_unix_chown($new, $this->main->__username_o);
             break;
         case "paste":
             if ($this->main->paste_list) {
                 // Hack... SPecifically checking for pasteaction. Should just use it directly in the command.
                 $arglist[] = $this->main->__username_o;
                 foreach ($this->main->paste_list as &$_tl) {
                     $_tl = $this->main->root . $_tl;
                 }
                 //$arglist = array_merge($arglist, $this->main->paste_list);
                 $arglist[] = $this->main->paste_list;
                 $arglist[] = $this->main->fullpath;
                 if ($this->main->pasteaction === 'copy') {
                     foreach ($this->main->paste_list as $p) {
                         lxfile_cp_rec($p, $this->main->fullpath);
                     }
                 } else {
                     foreach ($this->main->paste_list as $p) {
                         lxfile_mv_rec($p, $this->main->fullpath);
                     }
                 }
                 //lxfile_unix_chown_rec($this->main->fullpath, $this->main->__username_o);
             }
             break;
         case "perm":
             throw new lxexception('no_perm_setting', '');
             break;
         case "newdir":
             $i = 1;
             $rpath = $this->main->fullpath;
             $name = "/" . $this->main->newfolder_f;
             $path = $rpath . $name;
             if (lxfile_exists($path)) {
                 throw new lxexception('file_exists', '');
             }
             lxfile_mkdir($path);
             break;
         case "zip_file":
             foreach ($this->main->zip_file_list as &$_t_f) {
                 $_t_f = coreFfile::removeLeadingSlash($_t_f);
                 $_t_f = basename($_t_f);
                 $_t_f = "\"{$_t_f}\"";
             }
             $list = implode(" ", $this->main->zip_file_list);
             $oldir = getcwd();
             $fullpath = expand_real_root($this->main->fullpath);
             do_exec_system($this->main->__username_o, $fullpath, "c:/Progra~1/7-Zip/7z a NewArchive.zip {$list}", $out, $err, $ret, null);
             break;
         case "filedelete":
             foreach ($this->main->filedelete_list as $f) {
                 ffile__common::moveToTrash($this->main->root, $f);
             }
             break;
         case "restore_trash":
             foreach ($this->main->restore_trash_list as $f) {
                 ffile__common::restoreFromTrash($this->main->root, $f);
             }
             break;
         case "clear_trash":
             foreach ($this->main->clear_trash_list as $f) {
                 ffile__common::clearFromTrash($this->main->root, $f);
             }
             break;
         case "zipextract":
             $fulzippath = $this->main->root . $this->main->zip_extract_dir_f;
             if (!lxfile_exists(null, $fulzippath)) {
                 lxfile_mkdir($fulzippath);
             } else {
                 $zipdir = new Ffile("localhost", "localhost", $this->main->root, $this->main->zip_extract_dir_f, $this->main->__username_o);
                 $zipdir->get();
                 if (!$zipdir->is_dir()) {
                     throw new lxexception("file_exists_but_not_dir", 'unzippath', $this->main->zip_extract_dir_f);
                 }
             }
             $command = "c:/Progra~1/7-zip/7z x -y";
             $dir = expand_real_root($fulzippath);
             $file = expand_real_root($this->main->getFullPath());
             if (!csa($file, ":")) {
                 $fullpath = getcwd() . "/{$file}";
             } else {
                 $fullpath = $file;
             }
             $oldir = getcwd();
             $fullpath = expand_real_root($fullpath);
             do_exec_system($this->main->__username_o, $dir, "{$command} {$fullpath}", $out, $err, $ret, null);
             break;
     }
 }
Beispiel #7
0
    lxfile_mkdir("{$cdir}/old");
    lxfile_mkdir("{$cdir}/cgi-bin");
    foreach ($dlist as $l) {
        if (lxfile_exists("{$cdir}/{$l->nname}")) {
            lxfile_mv_rec("{$cdir}/{$l->nname}", "{$cdir}/old/");
        }
        if (!is_link("{$cdir}/domain/{$l->nname}/www/")) {
            lxfile_mv_rec("{$cdir}/domain/{$l->nname}/www/", "{$cdir}/{$l->nname}");
        }
        /*
        	foreach($l->subweb_a as $k => $v) {
        		lxfile_mv_rec("$cdir/domain/$l->nname/subdomains/$v->nname", "$cdir/$l->nname/$v->nname");
        	}
        */
        if (!is_link("{$cdir}/domain/{$l->nname}/cgi-bin/")) {
            lxfile_mv_rec("{$cdir}/domain/{$l->nname}/cgi-bin/", "{$cdir}/cgi-bin/{$l->nname}");
        }
        lunlink("{$cdir}/domain/{$l->nname}/www");
        lxfile_symlink("{$cdir}/{$l->nname}", "{$cdir}/domain/{$l->nname}/www");
        lxfile_symlink("{$cdir}/cgi-bin/{$l->nname}", "{$cdir}/domain/{$l->nname}/cgi-bin");
        $web = $l->getObject('web');
        $web->setUpdateSubaction('full_update');
        $dirlist = $web->getList('dirprotect');
        foreach ($dirlist as $dir) {
            $dir->setUpdateSubaction('full_update');
            $dir->was();
        }
        $web->was();
    }
}
lxshell_return("__path_php_path", "../bin/misc/fixftpuserclient.phps");
Beispiel #8
0
 public function copyKernelModules()
 {
     /*
      * For Xen we may have few different situation here:
      * 1. RHEL5 with pygrub template -> do nothing, follow pygrub procedure (skip copying of kernel modules)
      * 2. RHEL5 without pygrub template -> copy existing kernel modules
      * 3. RHEL6 with pygrub template -> same as for RHEL5
      * 4. RHEL6 without pygrub template -> check below:
      *  4a. if RHEL-5/CentOS-5 or old kloxo (hostinabox) -> copy lxkernel-domU-xen kernel modules
      *  4b. if other modern linux -> copy existing kernel modules
      *
      */
     $pygrub_record = explode('-', $this->main->ostemplate);
     if (!stripos($pygrub_record[3], 'pygrub') !== FALSE) {
         $mountpoint = $this->mount_this_guy();
         if (is_centosfive()) {
             $kernev = trim(`uname -r`);
         } else {
             if (char_search_beg($this->main->ostemplate, "centos-5")) {
                 $kernev = trim(`rpm -q --queryformat  '%{VERSION}-%{RELEASE}' lxkernel-domU-xen`);
                 $kernev .= 'xen';
             } else {
                 $kernev = trim(`uname -r`);
             }
         }
         if (!lxfile_exists("{$mountpoint}/lib/modules/{$kernev}")) {
             lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$kernev}");
         }
         if (char_search_end($kernev, "-xen")) {
             $nkernev = strtil($kernev, "-xen");
             if (!lxfile_exists("{$mountpoint}/lib/modules/{$nkernev}")) {
                 lxfile_cp_rec("/lib/modules/{$kernev}", "{$mountpoint}/lib/modules/{$nkernev}");
             }
         }
         if (char_search_beg($this->main->ostemplate, "centos-")) {
             if (lxfile_exists("{$mountpoint}/lib/tls")) {
                 lxfile_rm_rec("{$mountpoint}/lib/tls.disabled");
                 lxfile_mv_rec("{$mountpoint}/lib/tls", "{$mountpoint}/lib/tls.disabled");
             }
         }
     }
 }
Beispiel #9
0
$list = parse_opt($argv);
$server = isset($list['server']) ? $list['server'] : 'localhost';
$client = isset($list['client']) ? $list['client'] : null;
$login->loadAllObjects('client');
$list = $login->getList('client');
log_cleanup("Fixing cgi-bin path");
foreach ($list as $c) {
    if ($client) {
        //	if ($client !== $c->nname) { continue; }
        $ca = explode(",", $client);
        if (!in_array($c->nname, $ca)) {
            continue;
        }
        $server = 'all';
    }
    if ($server !== 'all') {
        //	if ($c->syncserver !== $server) { continue; }
        $sa = explode(",", $server);
        if (!in_array($c->syncserver, $sa)) {
            continue;
        }
    }
    $dlist = $c->getList('domaina');
    $cdir = "__path_customer_root/{$c->getPathFromName('nname')}";
    foreach ($dlist as $l) {
        $web = $l->getObject('web');
        lxfile_mv_rec("{$cdir}/cgi-bin/{$l->nname}", "{$cdir}/{$l->nname}/cgi-bin");
        $web->setUpdateSubaction('full_update');
        $web->was();
    }
}