Example #1
0
File: node.php Project: evanjt/core
 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());
     }
 }
Example #2
0
 /**
  * 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();
 }
Example #3
0
 /**
  * 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();
 }
Example #4
0
/**
 * @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;
}
Example #5
0
 /**
  * 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;
 }