/** * 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(); }
/** * Comparator function to sort files by size * * @param \OCP\Files\FileInfo $a file * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ public static function compareSize(FileInfo $a, FileInfo $b) { $aSize = $a->getSize(); $bSize = $b->getSize(); return $aSize < $bSize ? -1 : 1; }
/** * Returns the size of the node, in bytes * * @return integer */ public function getSize() { return $this->info->getSize(); }
/** * {@inheritDoc} */ public function isAvailable(\OCP\Files\FileInfo $file) { return $file->getSize() > 0; }
/** * Comparator function to sort files by size * * @param \OCP\Files\FileInfo $a file * @param \OCP\Files\FileInfo $b file * @return int -1 if $a must come before $b, 1 otherwise */ public static function compareSize($a, $b) { $aSize = $a->getSize(); $bSize = $b->getSize(); return $aSize - $bSize; }