function mkdir() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $newname = $this->getParameter('newname', 'New Folder'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'newname' => $newname)); $model = new \App\Models\Ftp($ftp); $model->mkdir($current, $newname); }
function trash() { $ftp = $this->container->get('ftp'); // 휴지통 경로(환경변수로 설정할까?) $trash = '/.trash'; $trash = $this->container->get('config')->get('trash.path'); $model = new \App\Models\Ftp($ftp); $model->deleteRecursive($trash); $model->mkdir('/', $trash); echo json_encode(array('code' => 1, 'message' => '휴지통에 있는 항목을 모두 삭제했습니다.!!!')); }
function execute() { $ftp = $this->container->get('ftp'); $dir = $this->getParameter('dir', '/'); $parent = $this->getParameter('path', '/'); $folder = $this->getParameter('folder'); $file = $this->getParameter('file'); $current = rtrim($parent, '/') . '/' . ltrim($dir, '/'); $this->debug(array('dir' => $dir, 'parent' => $parent, 'current' => $current, 'folder' => $folder, 'file' => $file)); // 휴지통 경로(환경변수로 설정할까?) $trash = '/.trash'; $trash = $this->container->get('config')->get('trash.path'); $model = new \App\Models\Ftp($ftp); // 휴지통 생성하기 $model->mkdir('/', $trash); // 만일 휴지통에서 삭제하면.. if ($current == $trash) { $model->delete($current, $folder, $file); } else { $model->move($current, $folder, $file, $trash); } }