summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-06-12 10:38:12 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-06-18 12:53:20 +0200
commiteca536d8b49ed6a51e54040cd8104397f05defb3 (patch)
tree3341691385880dd360e81710a5a2c7d8961f3a0d /lib
parentc020e8e658ce7cd020356f303eb041886b4ac9cd (diff)
downloadnextcloud-server-eca536d8b49ed6a51e54040cd8104397f05defb3.tar.gz
nextcloud-server-eca536d8b49ed6a51e54040cd8104397f05defb3.zip
minor code cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/objectstore/abstractobjectstore.php13
-rw-r--r--lib/private/files/objectstore/noopscanner.php33
2 files changed, 14 insertions, 32 deletions
diff --git a/lib/private/files/objectstore/abstractobjectstore.php b/lib/private/files/objectstore/abstractobjectstore.php
index 43f0a973594..8d65e18b6cc 100644
--- a/lib/private/files/objectstore/abstractobjectstore.php
+++ b/lib/private/files/objectstore/abstractobjectstore.php
@@ -24,10 +24,12 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
/**
* @param string $urn the unified resource name used to identify the object
+ * @param string $tmpFile path to the local temporary file that the object
+ * should be loaded from
* @return void
* @throws Exception when something goes wrong, message will be logged
*/
- abstract protected function deleteObject($urn);
+ abstract protected function createObject($urn, $tmpFile = null);
/**
* @param string $urn the unified resource name used to identify the object
@@ -40,12 +42,10 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
/**
* @param string $urn the unified resource name used to identify the object
- * @param string $tmpFile path to the local temporary file that the object
- * should be loaded from
* @return void
* @throws Exception when something goes wrong, message will be logged
*/
- abstract protected function createObject($urn, $tmpFile = null);
+ abstract protected function deleteObject($urn);
/**
* @var \OC\User\User $user
@@ -411,8 +411,11 @@ abstract class AbstractObjectStore extends \OC\Files\Storage\Common {
}
/**
+ * Override this method if you need a different unique resource identifier for your object storage implementation.
+ * The default implementations just appends the fileId to 'urn:oid:'. Make sure the URN is unique over all users.
+ * You may need a mapping table to store your URN if it cannot be generated from the fileid.
* @param int $fileId the fileid
- * @return null|string
+ * @return null|string the unified resource name used to identify the object
*/
protected function getURN($fileId) {
if (is_numeric($fileId)) {
diff --git a/lib/private/files/objectstore/noopscanner.php b/lib/private/files/objectstore/noopscanner.php
index 8971db65dc9..59ca1771971 100644
--- a/lib/private/files/objectstore/noopscanner.php
+++ b/lib/private/files/objectstore/noopscanner.php
@@ -19,34 +19,13 @@
*/
namespace OC\Files\ObjectStore;
+use \OC\Files\Cache\Scanner;
+use \OC\Files\Storage\Storage;
-class NoopScanner extends \OC\Files\Cache\Scanner {
+class NoopScanner extends Scanner {
- /**
- * get all the metadata of a file or folder
- * *
- *
- * @param string $path
- * @return array with metadata of the file
- */
- public function getData($path) {
- if (!$this->storage->isReadable($path)) {
- //cant read, nothing we can do
- \OCP\Util::writeLog('OC\Files\ObjectStore\NoopScanner', "!!! Path '$path' is not readable !!!", \OCP\Util::DEBUG);
- return null;
- }
- $data = array();
- $data['mimetype'] = $this->storage->getMimeType($path);
- $data['mtime'] = $this->storage->filemtime($path);
- if ($data['mimetype'] == 'httpd/unix-directory') {
- $data['size'] = -1; //unknown
- } else {
- $data['size'] = $this->storage->filesize($path);
- }
- $data['etag'] = $this->storage->getETag($path);
- $data['storage_mtime'] = $data['mtime'];
- $data['permissions'] = $this->storage->getPermissions($path);
- return $data;
+ public function __construct(Storage $storage) {
+ //we don't need the storage, so do nothing here
}
/**
@@ -81,7 +60,7 @@ class NoopScanner extends \OC\Files\Cache\Scanner {
* @param int $reuse
* @return int the size of the scanned folder or -1 if the size is unknown at this stage
*/
- public function scanChildren($path, $recursive = \OC\Files\Storage\Storage::SCAN_RECURSIVE, $reuse = -1) {
+ public function scanChildren($path, $recursive = Storage::SCAN_RECURSIVE, $reuse = -1) {
$size = 0;
return $size;
}