public function sfvCreate($paths) { $sfvfile = $this->getUserDir($paths->target); $files = array_map(array($this, 'getWorkDir'), (array) $paths->fls); if (Fs::get()->isFile($sfvfile)) { throw new Exception("File already exists", 16); } $temp = Helper::getTempDir(); $args = array('action' => 'sfvCreate', 'params' => array('files' => $files, 'target' => $sfvfile), 'temp' => $temp); $task = $temp['dir'] . 'task'; file_put_contents($task, json_encode($args)); $task_opts = array('requester' => 'filemanager', 'name' => 'SFV create'); $rtask = new \rTask($task_opts); $commands = array(Helper::getTaskCmd() . " " . escapeshellarg($task)); $ret = $rtask->start($commands, 0); //var_dump($ret); return $temp; }
public function extract($to) { $formatBin = self::getFormatBinary($this->file); if (!$formatBin) { throw new Exception("Error Processing Request", 18); } $temp = Helper::getTempDir(); $args = array('action' => 'extract', 'params' => array('file' => $this->file, 'to' => $to, 'binary' => getExternal($formatBin)), 'temp' => $temp); $task = $temp['dir'] . 'task'; file_put_contents($task, json_encode($args)); $task_opts = array('requester' => 'filemanager', 'name' => 'unpack'); $rtask = new \rTask($task_opts); $commands = array(Helper::getTaskCmd() . " " . escapeshellarg($task)); $ret = $rtask->start($commands, 0); return $temp; }