Exemple #1
0
function lxfile_unix_chown($file, $mod)
{
    $file = expand_real_root($file);
    log_filesys("Chown {$file} to {$mod}");
    $stat = stat($file);
    //dprintr($stat);
    if (!is_dir($file) && $stat['nlink'] > 1) {
        log_log("link_error", "{$file} is a hard link not chowning");
        return;
    }
    if (lis_link($file)) {
        log_log("link_error", "{$file} is link so no chown to {$mod}");
        return;
    }
    $group = null;
    if (csa($mod, ':')) {
        list($user, $group) = explode(':', $mod);
    } else {
        $user = $mod;
    }
    if (is_numeric($group)) {
        $group = (int) $group;
    }
    if ($group) {
        chgrp($file, $group);
    }
    if (is_numeric($user)) {
        $user = (int) $user;
    }
    $ret = chown($file, $user);
    if (!$ret) {
        dprint("Chown Error in file {$file}\n");
    }
    return $ret;
}
function lxfile_cp($src, $dst)
{
    global $gbl, $sgbl, $login, $ghtml;
    $src = expand_real_root($src);
    $dst = expand_real_root($dst);
    if (is_dir($dst)) {
        $dst = $dst . "/" . basename($src);
    }
    log_filesys("Copying {$src} {$dst}");
    return system("cp {$src} {$dst}");
}
Exemple #3
0
function lxfile_cp_rec($dirsource, $dirdest)
{
    dprint("<b> I am here </b> ");
    $obj = new COM("Scripting.FilesystemObject");
    $username = "******";
    $dirdest = expand_real_root($dirdest);
    $dirsource = expand_real_root($dirsource);
    if (lfile_exists($dirdest) && is_dir($dirdest)) {
        $dirdest = $dirdest . "/" . basename($dirsource);
    }
    if (is_dir($dirsource)) {
        log_filesys("copyFolder {$dirsource} {$dirdest}");
        $obj->CopyFolder($dirsource, $dirdest);
    } else {
        log_filesys("copyFile {$dirsource} {$dirdest}");
        $obj->CopyFile($dirsource, $dirdest);
    }
}