function doRealGetFromFileServ($cmd, $serv, $filepass, $copyto = null) { $file = $filepass['file']; $pass = $filepass['pass']; $size = $filepass['size']; $base = basename($file); if ($serv === 'localhost') { $array = lfile_get_unserialize("__path_serverfile/{$base}"); $realfile = $array['filename']; log_log("servfile", "getting local file {$realfile}"); if (lxfile_exists($realfile) && lis_readable($realfile)) { lunlink("__path_serverfile/{$base}"); if ($cmd === 'fileprint') { slow_print($realfile); } else { lxfile_mkdir(dirname($copyto)); lxfile_cp($realfile, $copyto); } fileserv_unlink_if_tmp($realfile); return; } if (os_isSelfSystemUser()) { log_log("servfile", "is System User, but can't access {$realfile} returning"); //return; } else { log_log("servfile", "is Not system user, can't access so will get {$realfile} through backend"); } } $fd = null; if ($copyto) { lxfile_mkdir(dirname($copyto)); $fd = lfopen($copyto, "wb"); if (!$fd) { log_log("servfile", "Could not write to {$copyto}... Returning."); return; } lxfile_generic_chmod($copyto, "0700"); } doGetOrPrintFromFileServ($serv, $filepass, $cmd, $fd); if ($fd) { fclose($fd); } }
function updateBackupOLD($param) { $bfile = tempnam("/tmp", "backupzip.zip"); lunlink($bfile); $vd = createTempDir("/tmp", "backup"); $list = $this->doCoreBackup($vd, $param); lxshell_zip($vd, $bfile, $list); lxfile_tmp_rm_rec($vd); $fname = $this->getBackupFileNameForObject('out-' . time()); ob_end_clean(); header('Content-Type: application/octet-stream'); header("Content-Disposition: attachment; filename={$fname}"); slow_print($bfile); flush(); @lunlink($bfile); exit; }