Skip to content

Commit e8ed1cd

Browse files
fix: add missing oc_files_storage_common
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent d9ef0ae commit e8ed1cd

2 files changed

Lines changed: 359 additions & 0 deletions

File tree

‎psalm.xml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<file name="tests/stubs/oc_files_cache_cacheentry.php" />
4242
<file name="tests/stubs/oc_files_mount_manager.php" />
4343
<file name="tests/stubs/oc_files_mount_mountpoint.php" />
44+
<file name="tests/stubs/oc_files_storage_common.php" />
4445
<file name="tests/stubs/oc_files_storage_dav.php" />
4546
<file name="tests/stubs/oc_group_group.php" />
4647
<file name="tests/stubs/oc_group_manager.php" />
Lines changed: 358 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,358 @@
1+
<?php
2+
3+
/**
4+
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
5+
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
6+
* SPDX-License-Identifier: AGPL-3.0-only
7+
*/
8+
9+
namespace OC\Files\Storage;
10+
11+
use OC\Files\Cache\Cache;
12+
use OC\Files\Cache\CacheDependencies;
13+
use OC\Files\Cache\Propagator;
14+
use OC\Files\Cache\Scanner;
15+
use OC\Files\Cache\Updater;
16+
use OC\Files\Cache\Watcher;
17+
use OC\Files\FilenameValidator;
18+
use OC\Files\Filesystem;
19+
use OC\Files\ObjectStore\ObjectStoreStorage;
20+
use OC\Files\Storage\Wrapper\Encryption;
21+
use OC\Files\Storage\Wrapper\Jail;
22+
use OC\Files\Storage\Wrapper\Wrapper;
23+
use OCP\Constants;
24+
use OCP\Files\Cache\ICache;
25+
use OCP\Files\Cache\IPropagator;
26+
use OCP\Files\Cache\IScanner;
27+
use OCP\Files\Cache\IUpdater;
28+
use OCP\Files\Cache\IWatcher;
29+
use OCP\Files\FileInfo;
30+
use OCP\Files\ForbiddenException;
31+
use OCP\Files\GenericFileException;
32+
use OCP\Files\IFilenameValidator;
33+
use OCP\Files\IMimeTypeDetector;
34+
use OCP\Files\InvalidPathException;
35+
use OCP\Files\NotPermittedException;
36+
use OCP\Files\Storage\IConstructableStorage;
37+
use OCP\Files\Storage\ILockingStorage;
38+
use OCP\Files\Storage\IStorage;
39+
use OCP\Files\Storage\IWriteStreamStorage;
40+
use OCP\Files\StorageNotAvailableException;
41+
use OCP\IConfig;
42+
use OCP\IDBConnection;
43+
use OCP\Lock\ILockingProvider;
44+
use OCP\Lock\LockedException;
45+
use OCP\Server;
46+
use OCP\Util;
47+
use Override;
48+
use Psr\Log\LoggerInterface;
49+
50+
/**
51+
* Storage backend class for providing common filesystem operation methods
52+
* which are not storage-backend specific.
53+
*
54+
* \OC\Files\Storage\Common is never used directly; it is extended by all other
55+
* storage backends, where its methods may be overridden, and additional
56+
* (backend-specific) methods are defined.
57+
*
58+
* Some \OC\Files\Storage\Common methods call functions which are first defined
59+
* in classes which extend it, e.g. $this->stat() .
60+
*/
61+
abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, IConstructableStorage {
62+
use LocalTempFileTrait;
63+
64+
protected ?Cache $cache = null;
65+
protected ?Scanner $scanner = null;
66+
protected ?Watcher $watcher = null;
67+
protected ?Propagator $propagator = null;
68+
protected $storageCache;
69+
protected ?Updater $updater = null;
70+
71+
protected array $mountOptions = [];
72+
protected $owner = null;
73+
74+
public function __construct(array $parameters) {
75+
}
76+
77+
protected function remove(string $path): bool
78+
{
79+
}
80+
81+
#[\Override]
82+
public function is_dir(string $path): bool
83+
{
84+
}
85+
86+
#[\Override]
87+
public function is_file(string $path): bool
88+
{
89+
}
90+
91+
#[\Override]
92+
public function filesize(string $path): int|float|false
93+
{
94+
}
95+
96+
#[\Override]
97+
public function isReadable(string $path): bool
98+
{
99+
}
100+
101+
#[\Override]
102+
public function isUpdatable(string $path): bool
103+
{
104+
}
105+
106+
#[\Override]
107+
public function isCreatable(string $path): bool
108+
{
109+
}
110+
111+
#[\Override]
112+
public function isDeletable(string $path): bool
113+
{
114+
}
115+
116+
#[\Override]
117+
public function isSharable(string $path): bool
118+
{
119+
}
120+
121+
#[\Override]
122+
public function getPermissions(string $path): int
123+
{
124+
}
125+
126+
#[\Override]
127+
public function filemtime(string $path): int|false
128+
{
129+
}
130+
131+
#[\Override]
132+
public function file_get_contents(string $path): string|false
133+
{
134+
}
135+
136+
#[\Override]
137+
public function file_put_contents(string $path, mixed $data): int|float|false
138+
{
139+
}
140+
141+
#[\Override]
142+
public function rename(string $source, string $target): bool
143+
{
144+
}
145+
146+
#[\Override]
147+
public function copy(string $source, string $target): bool
148+
{
149+
}
150+
151+
#[\Override]
152+
public function getMimeType(string $path): string|false
153+
{
154+
}
155+
156+
#[\Override]
157+
public function hash(string $type, string $path, bool $raw = false): string|false
158+
{
159+
}
160+
161+
#[\Override]
162+
public function getLocalFile(string $path): string|false
163+
{
164+
}
165+
166+
protected function searchInDir(string $query, string $dir = ''): array
167+
{
168+
}
169+
170+
/**
171+
* @inheritDoc
172+
* Check if a file or folder has been updated since $time
173+
*
174+
* The method is only used to check if the cache needs to be updated. Storage backends that don't support checking
175+
* the mtime should always return false here. As a result storage implementations that always return false expect
176+
* exclusive access to the backend and will not pick up files that have been added in a way that circumvents
177+
* Nextcloud filesystem.
178+
*/
179+
#[\Override]
180+
public function hasUpdated(string $path, int $time): bool
181+
{
182+
}
183+
184+
protected function getCacheDependencies(): CacheDependencies
185+
{
186+
}
187+
188+
#[\Override]
189+
public function getCache(string $path = '', ?IStorage $storage = null): ICache
190+
{
191+
}
192+
193+
#[\Override]
194+
public function getScanner(string $path = '', ?IStorage $storage = null): IScanner
195+
{
196+
}
197+
198+
#[\Override]
199+
public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher
200+
{
201+
}
202+
203+
#[\Override]
204+
public function getPropagator(?IStorage $storage = null): IPropagator
205+
{
206+
}
207+
208+
#[\Override]
209+
public function getUpdater(?IStorage $storage = null): IUpdater
210+
{
211+
}
212+
213+
#[\Override]
214+
public function getStorageCache(?IStorage $storage = null): \OC\Files\Cache\Storage
215+
{
216+
}
217+
218+
#[\Override]
219+
public function getOwner(string $path): string|false
220+
{
221+
}
222+
223+
#[\Override]
224+
public function getETag(string $path): string|false
225+
{
226+
}
227+
228+
/**
229+
* clean a path, i.e. remove all redundant '.' and '..'
230+
* making sure that it can't point to higher than '/'
231+
*
232+
* @param string $path The path to clean
233+
* @return string cleaned path
234+
*/
235+
public function cleanPath(string $path): string
236+
{
237+
}
238+
239+
/**
240+
* Test a storage for availability
241+
*/
242+
#[\Override]
243+
public function test(): bool
244+
{
245+
}
246+
247+
#[\Override]
248+
public function free_space(string $path): int|float|false
249+
{
250+
}
251+
252+
#[\Override]
253+
public function isLocal(): bool
254+
{
255+
}
256+
257+
/**
258+
* Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class
259+
*/
260+
#[\Override]
261+
public function instanceOfStorage(string $class): bool
262+
{
263+
}
264+
265+
#[Override]
266+
public function getDirectDownload(string $path): array|false
267+
{
268+
}
269+
270+
#[Override]
271+
public function getDirectDownloadById(string $fileId): array|false
272+
{
273+
}
274+
275+
#[\Override]
276+
public function verifyPath(string $path, string $fileName): void
277+
{
278+
}
279+
280+
/**
281+
* Get the filename validator
282+
* (cached for performance)
283+
*/
284+
protected function getFilenameValidator(): IFilenameValidator
285+
{
286+
}
287+
288+
public function setMountOptions(array $options): void
289+
{
290+
}
291+
292+
public function getMountOption(string $name, mixed $default = null): mixed
293+
{
294+
}
295+
296+
#[\Override]
297+
public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool
298+
{
299+
}
300+
301+
#[\Override]
302+
public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool
303+
{
304+
}
305+
306+
#[\Override]
307+
public function getMetaData(string $path): ?array
308+
{
309+
}
310+
311+
#[\Override]
312+
public function acquireLock(string $path, int $type, ILockingProvider $provider): void
313+
{
314+
}
315+
316+
#[\Override]
317+
public function releaseLock(string $path, int $type, ILockingProvider $provider): void
318+
{
319+
}
320+
321+
#[\Override]
322+
public function changeLock(string $path, int $type, ILockingProvider $provider): void
323+
{
324+
}
325+
326+
/**
327+
* @return array{available: bool, last_checked: int}
328+
*/
329+
#[\Override]
330+
public function getAvailability(): array
331+
{
332+
}
333+
334+
#[\Override]
335+
public function setAvailability(bool $isAvailable): void
336+
{
337+
}
338+
339+
#[\Override]
340+
public function setOwner(?string $user): void
341+
{
342+
}
343+
344+
#[\Override]
345+
public function needsPartFile(): bool
346+
{
347+
}
348+
349+
#[\Override]
350+
public function writeStream(string $path, $stream, ?int $size = null): int
351+
{
352+
}
353+
354+
#[\Override]
355+
public function getDirectoryContent(string $directory): \Traversable
356+
{
357+
}
358+
}

0 commit comments

Comments
 (0)