minor code cleanup

This commit is contained in:
Jörn Friedrich Dreyer 2014-06-12 10:38:12 +02:00
parent c020e8e658
commit eca536d8b4
2 changed files with 14 additions and 32 deletions

View File

@ -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)) {

View File

@ -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;
}