2016-08-01 12:27:07 -04:00
|
|
|
<?php
|
2025-06-30 09:04:05 -04:00
|
|
|
|
2016-08-01 12:27:07 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2016-08-01 12:27:07 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Lockdown\Filesystem;
|
|
|
|
|
|
|
|
|
|
use Icewind\Streams\IteratorDirectory;
|
2017-02-08 10:38:00 -05:00
|
|
|
use OC\Files\FileInfo;
|
2016-08-01 12:27:07 -04:00
|
|
|
use OC\Files\Storage\Common;
|
2024-09-19 12:19:34 -04:00
|
|
|
use OCP\Files\Cache\ICache;
|
2017-07-19 13:44:10 -04:00
|
|
|
use OCP\Files\Storage\IStorage;
|
2016-08-01 12:27:07 -04:00
|
|
|
|
|
|
|
|
class NullStorage extends Common {
|
2024-10-08 09:13:16 -04:00
|
|
|
public function __construct(array $parameters) {
|
2016-08-01 12:27:07 -04:00
|
|
|
parent::__construct($parameters);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-19 12:19:34 -04:00
|
|
|
public function getId(): string {
|
2016-08-01 12:27:07 -04:00
|
|
|
return 'null';
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function mkdir(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function rmdir(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function opendir(string $path): IteratorDirectory {
|
2025-07-15 06:56:51 -04:00
|
|
|
return new IteratorDirectory();
|
2016-08-01 12:27:07 -04:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function is_dir(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return $path === '';
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function is_file(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function stat(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function filetype(string $path): string|false {
|
2016-08-01 12:27:07 -04:00
|
|
|
return ($path === '') ? 'dir' : false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function filesize(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function isCreatable(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function isReadable(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return $path === '';
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function isUpdatable(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function isDeletable(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function isSharable(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getPermissions(string $path): int {
|
2024-09-19 12:19:34 -04:00
|
|
|
return 0;
|
2016-08-01 12:27:07 -04:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function file_exists(string $path): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return $path === '';
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function filemtime(string $path): int|false {
|
2016-08-01 12:27:07 -04:00
|
|
|
return ($path === '') ? time() : false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function file_get_contents(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function file_put_contents(string $path, mixed $data): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function unlink(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function rename(string $source, string $target): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function copy(string $source, string $target): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function fopen(string $path, string $mode): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getMimeType(string $path): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function hash(string $type, string $path, bool $raw = false): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function free_space(string $path): int {
|
2017-02-08 10:38:00 -05:00
|
|
|
return FileInfo::SPACE_UNKNOWN;
|
2016-08-01 12:27:07 -04:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function touch(string $path, ?int $mtime = null): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getLocalFile(string $path): string|false {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function hasUpdated(string $path, int $time): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getETag(string $path): string {
|
2016-08-01 12:27:07 -04:00
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-19 12:19:34 -04:00
|
|
|
public function isLocal(): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getDirectDownload(string $path): array|false {
|
2016-08-01 12:27:07 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-15 08:04:25 -04:00
|
|
|
public function getDirectDownloadById(string $fileId): array|false {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): never {
|
2016-08-01 12:27:07 -04:00
|
|
|
throw new \OC\ForbiddenException('This request is not allowed to access the filesystem');
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-19 12:19:34 -04:00
|
|
|
public function test(): bool {
|
2016-08-01 12:27:07 -04:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getOwner(string $path): string|false {
|
2024-09-16 10:00:30 -04:00
|
|
|
return false;
|
2016-08-01 12:27:07 -04:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 10:12:30 -04:00
|
|
|
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
|
2016-08-01 12:27:07 -04:00
|
|
|
return new NullCache();
|
|
|
|
|
}
|
|
|
|
|
}
|