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