Add checks for storage object
This commit is contained in:
parent
555dec2d92
commit
c47bf9bbce
|
@ -20,7 +20,7 @@ $mountPoints = array_reverse($mountPoints); //start with the mount point of $dir
|
|||
|
||||
foreach ($mountPoints as $mountPoint) {
|
||||
$storage = \OC\Files\Filesystem::getStorage($mountPoint);
|
||||
error_log('scanning mp '.$mountPoint);
|
||||
if ($storage) {
|
||||
ScanListener::$mountPoints[$storage->getId()] = $mountPoint;
|
||||
$scanner = $storage->getScanner();
|
||||
if ($force) {
|
||||
|
@ -28,6 +28,7 @@ foreach ($mountPoints as $mountPoint) {
|
|||
} else {
|
||||
$scanner->backgroundScan();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$eventSource->send('done', ScanListener::$fileCount);
|
||||
|
|
|
@ -671,12 +671,14 @@ class View {
|
|||
* - versioned
|
||||
*/
|
||||
public function getFileInfo($path) {
|
||||
$data = array();
|
||||
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $path);
|
||||
/**
|
||||
* @var \OC\Files\Storage\Storage $storage
|
||||
* @var string $internalPath
|
||||
*/
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path);
|
||||
if ($storage) {
|
||||
$cache = $storage->getCache();
|
||||
|
||||
if (!$cache->inCache($internalPath)) {
|
||||
|
@ -703,7 +705,7 @@ class View {
|
|||
|
||||
$permissionsCache = $storage->getPermissionsCache();
|
||||
$data['permissions'] = $permissionsCache->get($data['fileid'], \OC_User::getUser());
|
||||
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -714,12 +716,14 @@ class View {
|
|||
* @return array
|
||||
*/
|
||||
public function getDirectoryContent($directory, $mimetype_filter = '') {
|
||||
$result = array();
|
||||
$path = Filesystem::normalizePath($this->fakeRoot . '/' . $directory);
|
||||
/**
|
||||
* @var \OC\Files\Storage\Storage $storage
|
||||
* @var string $internalPath
|
||||
*/
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path);
|
||||
if ($storage) {
|
||||
$cache = $storage->getCache();
|
||||
|
||||
if (!$cache->inCache($internalPath)) {
|
||||
|
@ -737,6 +741,7 @@ class View {
|
|||
$dirLength = strlen($path);
|
||||
foreach ($mountPoints as $mountPoint) {
|
||||
$subStorage = Filesystem::getStorage($mountPoint);
|
||||
if ($subStorage) {
|
||||
$subCache = $subStorage->getCache();
|
||||
$rootEntry = $subCache->get('');
|
||||
|
||||
|
@ -753,6 +758,7 @@ class View {
|
|||
$files[] = $rootEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ids = array();
|
||||
|
||||
|
@ -782,7 +788,7 @@ class View {
|
|||
} else {
|
||||
$result = $files;
|
||||
}
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -802,6 +808,7 @@ class View {
|
|||
* @var string $internalPath
|
||||
*/
|
||||
list($storage, $internalPath) = Filesystem::resolvePath($path);
|
||||
if ($storage) {
|
||||
$cache = $storage->getCache();
|
||||
|
||||
if (!$cache->inCache($internalPath)) {
|
||||
|
@ -810,6 +817,9 @@ class View {
|
|||
}
|
||||
|
||||
return $cache->put($internalPath, $data);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -843,6 +853,7 @@ class View {
|
|||
|
||||
$mountPoint = Filesystem::getMountPoint($this->fakeRoot);
|
||||
$storage = Filesystem::getStorage($mountPoint);
|
||||
if ($storage) {
|
||||
$cache = $storage->getCache();
|
||||
|
||||
$results = $cache->$method($query);
|
||||
|
@ -856,6 +867,7 @@ class View {
|
|||
$mountPoints = Filesystem::getMountPoints($this->fakeRoot);
|
||||
foreach ($mountPoints as $mountPoint) {
|
||||
$storage = Filesystem::getStorage($mountPoint);
|
||||
if ($storage) {
|
||||
$cache = $storage->getCache();
|
||||
|
||||
$relativeMountPoint = substr($mountPoint, $rootLength);
|
||||
|
@ -865,7 +877,8 @@ class View {
|
|||
$files[] = $result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return $files;
|
||||
}
|
||||
|
||||
|
@ -881,6 +894,10 @@ class View {
|
|||
* @var string $internalPath
|
||||
*/
|
||||
list($storage, $internalPath) = $this->resolvePath($path);
|
||||
if ($storage) {
|
||||
return $storage->getETag($internalPath);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue