protected function verifyPath() { try { $fileName = basename($this->info->getPath()); $this->fileView->verifyPath($this->path, $fileName); } catch (\OCP\Files\InvalidPathException $ex) { throw new InvalidPath($ex->getMessage()); } }
/** * Create a new file search result * @param FileInfo $data file data given by provider */ public function __construct(FileInfo $data) { $path = $this->getRelativePath($data->getPath()); $info = pathinfo($path); $this->id = $data->getId(); $this->name = $info['basename']; $this->link = \OCP\Util::linkTo('files', 'index.php', array('dir' => $info['dirname'], 'file' => $info['basename'])); $this->permissions = $data->getPermissions(); $this->path = $path; $this->size = $data->getSize(); $this->modified = $data->getMtime(); $this->mime_type = $data->getMimetype(); }
/** * Create a new file search result * @param FileInfo $data file data given by provider */ public function __construct(FileInfo $data) { $path = $this->getRelativePath($data->getPath()); $info = pathinfo($path); $this->id = $data->getId(); $this->name = $info['basename']; $this->link = \OC::$server->getURLGenerator()->linkToRoute('files.view.index', ['dir' => $info['dirname'], 'scrollto' => $info['basename']]); $this->permissions = $data->getPermissions(); $this->path = $path; $this->size = $data->getSize(); $this->modified = $data->getMtime(); $this->mime = $data->getMimetype(); }
/** * @param \OCP\Files\FileInfo $dir * @param \OC\Files\View $view * @return array */ function getChildInfo($dir, $view) { $children = $view->getDirectoryContent($dir->getPath()); $result = array(); foreach ($children as $child) { $formated = \OCA\Files\Helper::formatFileInfo($child); if ($child->getType() === 'dir') { $formated['children'] = getChildInfo($child, $view); } $formated['mtime'] = $formated['mtime'] / 1000; $result[] = $formated; } return $result; }
/** * Sets up the node, expects a full path name * @param \OC\Files\View $view * @param \OCP\Files\FileInfo $info */ public function __construct($view, $info) { $this->fileView = $view; $this->path = $this->fileView->getRelativePath($info->getPath()); $this->info = $info; }