summaryrefslogtreecommitdiffstats
path: root/lib/private/search
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-07-09 14:47:43 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-07-09 14:47:43 +0200
commit3f093974f9c5d9e739ba8e18098bef05bee1621f (patch)
tree8b5dc437508328409250a32a811e58e61d509dd9 /lib/private/search
parent404ac8bcd32aca8f9b004621ac737800cd86dfd1 (diff)
downloadnextcloud-server-3f093974f9c5d9e739ba8e18098bef05bee1621f.tar.gz
nextcloud-server-3f093974f9c5d9e739ba8e18098bef05bee1621f.zip
use fileinfo object in search results
Diffstat (limited to 'lib/private/search')
-rw-r--r--lib/private/search/result/file.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/private/search/result/file.php b/lib/private/search/result/file.php
index da5fa64ef45..82c425adb15 100644
--- a/lib/private/search/result/file.php
+++ b/lib/private/search/result/file.php
@@ -18,7 +18,9 @@
*/
namespace OC\Search\Result;
-use \OC\Files\Filesystem;
+use OC\Files\Filesystem;
+use OCP\Files\FileInfo;
+
/**
* A found file
*/
@@ -65,20 +67,20 @@ class File extends \OCP\Search\Result {
* Create a new file search result
* @param array $data file data given by provider
*/
- public function __construct(array $data = null) {
- $info = pathinfo($data['path']);
- $this->id = $data['fileid'];
+ public function __construct(FileInfo $data) {
+ $info = pathinfo($data->getPath());
+ $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 = self::get_permissions($data['path']);
- $this->path = (strpos($data['path'], 'files') === 0) ? substr($data['path'], 5) : $data['path'];
- $this->size = $data['size'];
- $this->modified = $data['mtime'];
- $this->mime_type = $data['mimetype'];
+ $this->permissions = self::get_permissions($data->getPath());
+ $this->path = (strpos($data->getPath(), 'files') === 0) ? substr($data->getPath(), 5) : $data->getPath();
+ $this->size = $data->getSize();
+ $this->modified = $data->getMtime();
+ $this->mime_type = $data->getMimetype();
}
/**