Ejemplo n.º 1
0
function cp_fileserv($file)
{
    lxfile_mkdir("__path_serverfile");
    lxfile_generic_chown("__path_serverfile", "lxlabs:lxlabs");
    $file = expand_real_root($file);
    dprint("Fileserv copying file {$file}\n");
    if (is_dir($file)) {
        $list = lscandir_without_dot($file);
        $res = tar_to_fileserv($file, $list);
        $res['type'] = "dir";
        return $res;
    } else {
        $res['type'] = 'file';
    }
    $basebase = basename($file);
    $base = basename(ltempnam("__path_serverfile", $basebase));
    $pass = md5($file . time());
    $ar = array('filename' => $file, 'password' => $pass);
    lfile_put_serialize("__path_serverfile/{$base}", $ar);
    lxfile_generic_chown("__path_serverfile/{$base}", "lxlabs");
    $res['file'] = $base;
    $res['pass'] = $pass;
    //$stat = llstat("__path_serverfile/$base");
    $res['size'] = lxfile_size($file);
    return $res;
}
Ejemplo n.º 2
0
 function top_level_network_backup()
 {
     $bc = $this->do_backup();
     if (!count($bc[1])) {
         $bc[1][] = 'blank_file';
         lxfile_touch("{$bc[0]}/blank_file");
     }
     if ($this->main->getZiptype() === 'zip') {
         $res = zip_to_fileserv($bc[0], $bc[1]);
     } else {
         if ($this->main->getZiptype() === 'tar') {
             $res = tar_to_fileserv($bc[0], $bc[1]);
         } else {
             $res = tgz_to_fileserv($bc[0], $bc[1]);
         }
     }
     $this->do_backup_cleanup($bc);
     return $res;
 }