use OCP\AppFramework\Http;
use OCP\Constants;
use OCP\Federation\ICloudId;
+use OCP\Files\Cache\ICache;
+use OCP\Files\Cache\IScanner;
+use OCP\Files\Cache\IWatcher;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IDisableEncryptionStorage;
use OCP\Files\Storage\IReliableEtagStorage;
);
}
- public function getWatcher($path = '', $storage = null) {
+ public function getWatcher($path = '', $storage = null): IWatcher {
if (!$storage) {
$storage = $this;
}
return $this->password;
}
- /**
- * Get id of the mount point.
- * @return string
- */
- public function getId() {
+ public function getId(): string {
return 'shared::' . md5($this->token . '@' . $this->getRemote());
}
- public function getCache($path = '', $storage = null) {
+ public function getCache($path = '', $storage = null): ICache {
if (is_null($this->cache)) {
$this->cache = new Cache($this, $this->cloudId);
}
return $this->cache;
}
- public function getScanner($path = '', $storage = null) {
+ public function getScanner($path = '', $storage = null): IScanner {
if (!$storage) {
$storage = $this;
}
return $this->scanner;
}
- /**
- * Check if a file or folder has been updated since $time
- *
- * @param string $path
- * @param int $time
- * @throws \OCP\Files\StorageNotAvailableException
- * @throws \OCP\Files\StorageInvalidException
- * @return bool
- */
- public function hasUpdated($path, $time) {
+ public function hasUpdated($path, $time): bool {
// since for owncloud webdav servers we can rely on etag propagation we only need to check the root of the storage
// because of that we only do one check for the entire storage per request
if ($this->updateChecked) {
}
}
- public function test() {
+ public function test(): bool {
try {
return parent::test();
} catch (StorageInvalidException $e) {
}
}
- public function file_exists($path) {
+ public function file_exists($path): bool {
if ($path === '') {
return true;
} else {
return $permissions;
}
- public function needsPartFile() {
+ public function needsPartFile(): bool {
return false;
}
return $permissions;
}
- public function free_space($path) {
+ public function free_space($path): int|float|false {
return parent::free_space('');
}
use OC\Files\Cache\CacheDependencies;
use OC\Files\Cache\FailedCache;
use OC\Files\Cache\NullWatcher;
-use OC\Files\Cache\Watcher;
use OC\Files\ObjectStore\HomeObjectStoreStorage;
use OC\Files\Storage\Common;
use OC\Files\Storage\FailedStorage;
use OC\Files\Storage\Home;
+use OC\Files\Storage\Storage;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\Storage\Wrapper\Wrapper;
use OC\User\NoUserException;
use OCA\Files_External\Config\ConfigAdapter;
use OCA\Files_Sharing\ISharedStorage as LegacyISharedStorage;
use OCP\Constants;
+use OCP\Files\Cache\ICache;
use OCP\Files\Cache\ICacheEntry;
+use OCP\Files\Cache\IScanner;
+use OCP\Files\Cache\IWatcher;
use OCP\Files\Config\IUserMountCache;
use OCP\Files\Folder;
use OCP\Files\IHomeStorage;
/**
* @psalm-suppress NonInvariantDocblockPropertyType
- * @var ?\OC\Files\Storage\Storage $storage
+ * @var ?Storage $storage
*/
protected $storage;
}
/**
- * @psalm-assert \OC\Files\Storage\Storage $this->storage
+ * @psalm-assert Storage $this->storage
*/
private function init() {
if ($this->initialized) {
self::$initDepth--;
}
- /**
- * @inheritdoc
- */
public function instanceOfStorage($class): bool {
if ($class === '\OC\Files\Storage\Common' || $class == Common::class) {
return true;
return $this->getSourceRootInfo() && ($this->getSourceRootInfo()->getPermissions() & Constants::PERMISSION_SHARE) === Constants::PERMISSION_SHARE;
}
- /**
- * get id of the mount point
- *
- * @return string
- */
public function getId(): string {
return 'shared::' . $this->getMountPoint();
}
- /**
- * Get the permissions granted for a shared file
- *
- * @param string $path Shared target file path
- * @return int CRUDS permissions granted
- */
public function getPermissions($path = ''): int {
if (!$this->isValid()) {
return 0;
return $this->nonMaskedStorage->fopen($this->getUnjailedPath($path), $mode);
}
- /**
- * see https://www.php.net/manual/en/function.rename.php
- *
- * @param string $source
- * @param string $target
- * @return bool
- */
public function rename($source, $target): bool {
$this->init();
$isPartFile = pathinfo($source, PATHINFO_EXTENSION) === 'part';
return $this->superShare->getShareOwner();
}
- /**
- * @return \OCP\Share\IShare
- */
public function getShare(): IShare {
return $this->superShare;
}
return $this->superShare->getNodeType();
}
- public function getCache($path = '', $storage = null) {
+ public function getCache($path = '', $storage = null): ICache {
if ($this->cache) {
return $this->cache;
}
return $this->cache;
}
- public function getScanner($path = '', $storage = null) {
+ public function getScanner($path = '', $storage = null): IScanner {
if (!$storage) {
$storage = $this;
}
return $this->superShare->getShareOwner();
}
- public function getWatcher($path = '', $storage = null): Watcher {
+ public function getWatcher($path = '', $storage = null): IWatcher {
if ($this->watcher) {
return $this->watcher;
}
return true;
}
- public function acquireLock($path, $type, ILockingProvider $provider) {
+ public function acquireLock($path, $type, ILockingProvider $provider): void {
/** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->acquireLock($targetInternalPath, $type, $provider);
}
}
- public function releaseLock($path, $type, ILockingProvider $provider) {
+ public function releaseLock($path, $type, ILockingProvider $provider): void {
/** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->releaseLock($targetInternalPath, $type, $provider);
}
}
- public function changeLock($path, $type, ILockingProvider $provider) {
+ public function changeLock($path, $type, ILockingProvider $provider): void {
/** @var ILockingStorage $targetStorage */
[$targetStorage, $targetInternalPath] = $this->resolvePath($path);
$targetStorage->changeLock($targetInternalPath, $type, $provider);
}
- /**
- * @return array [ available, last_checked ]
- */
- public function getAvailability() {
+ public function getAvailability(): array {
// shares do not participate in availability logic
return [
'available' => true,
];
}
- /**
- * @param bool $isAvailable
- */
- public function setAvailability($isAvailable) {
+ public function setAvailability($isAvailable): void {
// shares do not participate in availability logic
}
return $this->nonMaskedStorage;
}
- public function getWrapperStorage() {
+ public function getWrapperStorage(): Storage {
$this->init();
/**
return $this->storage;
}
- public function file_get_contents($path) {
+ public function file_get_contents($path): string|false {
$info = [
'target' => $this->getMountPoint() . '/' . $path,
'source' => $this->getUnjailedPath($path),
return parent::file_get_contents($path);
}
- public function file_put_contents($path, $data) {
+ public function file_put_contents($path, $data): int|float|false {
$info = [
'target' => $this->getMountPoint() . '/' . $path,
'source' => $this->getUnjailedPath($path),
$this->mountOptions = $options;
}
- public function getUnjailedPath($path) {
+ public function getUnjailedPath($path): string {
$this->init();
return parent::getUnjailedPath($path);
}