Airship\Cabin\Bridge\Blueprint\Files::getContentsTree PHP 메소드

getContentsTree() 공개 메소드

Get the contents of a given cabin/directory, recursively
public getContentsTree ( string $cabin, string $base, string $thisDir ) : array
$cabin string
$base string
$thisDir string
리턴 array
    public function getContentsTree(string $cabin, string $base, string $thisDir) : array
    {
        $pieces = \Airship\chunk($base);
        foreach (\Airship\chunk($thisDir) as $p) {
            \array_push($pieces, $p);
        }
        try {
            $dirId = $this->getDirectoryId($pieces, $cabin);
        } catch (FileNotFound $ex) {
            return [];
        }
        return $this->getContentsIterative($dirId, $thisDir, $cabin);
    }

Usage Example

예제 #1
0
 /**
  * Move/Rename a directory
  *
  * @param string $path
  * @param string $cabin
  */
 protected function commonMoveDir(string $path, string $cabin)
 {
     if (!$this->permCheck()) {
         \Airship\redirect($this->airship_cabin_prefix);
     }
     list($publicPath, $root) = $this->loadCommonData($path, $cabin);
     if (empty($root)) {
         \Airship\redirect($this->airship_cabin_prefix);
     }
     $forParent = \Airship\chunk($path);
     $dir_name = \array_pop($forParent);
     $parent = \implode('/', $forParent);
     $contents = $this->files->getContentsTree($cabin, $this->root_dir, $path);
     $post = $this->post(new MoveDirFilter());
     if (!empty($post)) {
         if ($this->files->moveDir($cabin, $this->root_dir, $path, $post)) {
             \Airship\redirect($this->airship_cabin_prefix . '/' . $this->path_middle . '/' . $cabin, ['dir' => $parent]);
         }
     }
     $ignore = $path . '/';
     $this->lens('files/move_dir', ['cabins' => $this->getCabinNamespaces(), 'root_dir' => $this->root_dir, 'dir_contents' => $contents, 'all_dirs' => $this->files->getDirectoryTree($cabin, $this->root_dir, $ignore), 'parent_dir' => $parent, 'dir' => $path, 'dir_name' => $dir_name, 'cabin' => $cabin, 'pathinfo' => $publicPath]);
 }