Skip to content

Commit ee05f2a

Browse files
fix: avoid CI errors
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
1 parent 3162855 commit ee05f2a

13 files changed

Lines changed: 228 additions & 187 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ You can use the `\Psr\Container\ContainerInterface`, see [dependency injection](
2121

2222
# Testing
2323
Front-end tests (Vitest for unit/component, Playwright for end-to-end) are documented in [TESTING.md](TESTING.md).
24+

tests/stubs/doctrine_dbal_driver_exception.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,5 @@ interface Exception extends Throwable
1515
*
1616
* @return string|null
1717
*/
18-
public function getSQLState()
19-
{
20-
}
18+
public function getSQLState();
2119
}

tests/stubs/oc_hooks_emitter.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ interface Emitter {
2525
* @return void
2626
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::addListener
2727
*/
28-
public function listen($scope, $method, callable $callback)
29-
{
30-
}
28+
public function listen($scope, $method, callable $callback);
3129

3230
/**
3331
* @param string $scope optional
@@ -36,7 +34,5 @@ public function listen($scope, $method, callable $callback)
3634
* @return void
3735
* @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher::removeListener
3836
*/
39-
public function removeListener($scope = null, $method = null, ?callable $callback = null)
40-
{
41-
}
37+
public function removeListener($scope = null, $method = null, ?callable $callback = null);
4238
}

tests/stubs/oca_dav_carddav_contactsmanager.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
66
* SPDX-License-Identifier: AGPL-3.0-only
77
*/
8+
89
namespace OCA\DAV\CardDAV;
910

1011
use OCA\DAV\AppInfo\Application;

tests/stubs/oca_files_sharing_external_storage.php

Lines changed: 180 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,124 @@
66
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
77
* SPDX-License-Identifier: AGPL-3.0-only
88
*/
9+
910
namespace OCA\Files_Sharing\External;
1011

12+
use GuzzleHttp\Exception\ClientException;
13+
use GuzzleHttp\Exception\ConnectException;
14+
use GuzzleHttp\Exception\RequestException;
15+
use OC\Files\Storage\BearerAuthAwareSabreClient;
16+
use OC\Files\Storage\DAV;
17+
use OC\ForbiddenException;
18+
use OCA\Files_Sharing\External\Manager as ExternalShareManager;
19+
use OCA\Files_Sharing\ISharedStorage;
20+
use OCP\AppFramework\Http;
21+
use OCP\Constants;
22+
use OCP\Federation\ICloudId;
1123
use OCP\Files\Cache\ICache;
1224
use OCP\Files\Cache\IScanner;
1325
use OCP\Files\Cache\IWatcher;
26+
use OCP\Files\NotFoundException;
1427
use OCP\Files\Storage\IDisableEncryptionStorage;
1528
use OCP\Files\Storage\IReliableEtagStorage;
1629
use OCP\Files\Storage\IStorage;
30+
use OCP\Files\StorageInvalidException;
31+
use OCP\Files\StorageNotAvailableException;
32+
use OCP\Http\Client\IClientService;
33+
use OCP\Http\Client\LocalServerException;
34+
use OCP\IAppConfig;
35+
use OCP\ICacheFactory;
36+
use OCP\IConfig;
37+
use OCP\IUserSession;
38+
use OCP\OCM\Exceptions\OCMArgumentException;
39+
use OCP\OCM\Exceptions\OCMProviderException;
40+
use OCP\OCM\IOCMDiscoveryService;
41+
use OCP\Server;
42+
use OCP\Share\IManager as IShareManager;
43+
use Psr\Log\LoggerInterface;
44+
45+
class Storage extends DAV implements ISharedStorage, IDisableEncryptionStorage, IReliableEtagStorage {
46+
protected IAppConfig $appConfig;
47+
48+
private const int REFRESH_MAX_ATTEMPTS = 3;
49+
private const int REFRESH_BACKOFF_SECONDS = 5;
1750

18-
class Storage implements IDisableEncryptionStorage, IReliableEtagStorage {
19-
public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher {
20-
}
21-
22-
public function getRemoteUser(): string {
23-
}
24-
25-
public function getRemote(): string {
26-
}
27-
28-
public function getMountPoint(): string {
29-
}
30-
31-
public function getToken(): string {
32-
}
33-
34-
public function getPassword(): ?string {
35-
}
36-
37-
public function getId(): string {
38-
}
39-
40-
public function getCache(string $path = '', ?IStorage $storage = null): ICache {
41-
}
42-
43-
public function getScanner(string $path = '', ?IStorage $storage = null): IScanner {
44-
}
45-
46-
public function hasUpdated(string $path, int $time): bool {
47-
}
51+
/**
52+
* @param array{HttpClientService: IClientService, manager: ExternalShareManager, cloudId: ICloudId, mountpoint: string, token: string, access_token: ?string, access_token_expires: ?int}|array $options
53+
*/
54+
public function __construct($options)
55+
{
56+
}
4857

49-
public function test(): bool {
50-
}
58+
/**
59+
* Refresh the access token. Extends parent to also persist to database.
60+
*
61+
* Uses expiry timestamps instead of a boolean flag so that concurrent
62+
* processes can detect that another process already obtained a fresh token
63+
* and reuse it rather than performing a redundant exchange.
64+
*
65+
* After a failed exchange, a 60-second backoff is applied so that
66+
* subsequent file operations do not hammer the remote token endpoint.
67+
* The DB is still consulted during backoff in case a concurrent process
68+
* succeeded; only the outgoing exchange call is suppressed.
69+
*
70+
* @return string|null the access token (freshly exchanged or reused from
71+
* DB), or null if refresh is currently not possible
72+
*/
73+
#[\Override]
74+
protected function refreshAccessToken(): ?string
75+
{
76+
}
77+
78+
#[\Override]
79+
public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher
80+
{
81+
}
82+
83+
public function getRemoteUser(): string
84+
{
85+
}
86+
87+
public function getRemote(): string
88+
{
89+
}
90+
91+
public function getMountPoint(): string
92+
{
93+
}
94+
95+
public function getToken(): string
96+
{
97+
}
98+
99+
public function getPassword(): ?string
100+
{
101+
}
102+
103+
#[\Override]
104+
public function getId(): string
105+
{
106+
}
107+
108+
#[\Override]
109+
public function getCache(string $path = '', ?IStorage $storage = null): ICache
110+
{
111+
}
112+
113+
#[\Override]
114+
public function getScanner(string $path = '', ?IStorage $storage = null): IScanner
115+
{
116+
}
117+
118+
#[\Override]
119+
public function hasUpdated(string $path, int $time): bool
120+
{
121+
}
122+
123+
#[\Override]
124+
public function test(): bool
125+
{
126+
}
51127

52128
/**
53129
* Check whether this storage is permanently or temporarily
@@ -56,28 +132,82 @@ public function test(): bool {
56132
* @throws StorageNotAvailableException
57133
* @throws StorageInvalidException
58134
*/
59-
public function checkStorageAvailability(): void {
60-
}
135+
public function checkStorageAvailability(): void
136+
{
137+
}
61138

62-
public function file_exists(string $path): bool {
63-
}
139+
#[\Override]
140+
public function file_exists(string $path): bool
141+
{
142+
}
64143

65-
public function getShareInfo(int $depth = -1) {
66-
}
67-
68-
public function getOwner(string $path): string|false {
69-
}
144+
/**
145+
* Check if the configured remote is a valid-federated share provider
146+
*/
147+
protected function testRemote(): bool
148+
{
149+
}
70150

71-
public function isSharable(string $path): bool {
72-
}
151+
/**
152+
* Check whether the remote is an ownCloud/Nextcloud. This is needed since some sharing
153+
* features are not standardized.
154+
*
155+
* @throws LocalServerException
156+
*/
157+
public function remoteIsOwnCloud(): bool
158+
{
159+
}
73160

74-
public function getPermissions(string $path): int {
75-
}
161+
/**
162+
* @return mixed
163+
* @throws ForbiddenException
164+
* @throws NotFoundException
165+
* @throws \Exception
166+
*/
167+
public function getShareInfo(int $depth = -1)
168+
{
169+
}
170+
171+
#[\Override]
172+
public function getOwner(string $path): string|false
173+
{
174+
}
175+
176+
#[\Override]
177+
public function isSharable(string $path): bool
178+
{
179+
}
180+
181+
#[\Override]
182+
public function getPermissions(string $path): int
183+
{
184+
}
185+
186+
#[\Override]
187+
public function needsPartFile(): bool
188+
{
189+
}
76190

77-
public function needsPartFile(): bool {
78-
return false;
79-
}
191+
/**
192+
* Translate OCM Permissions to Nextcloud permissions
193+
*
194+
* @param string $ocmPermissions json encoded OCM permissions
195+
* @param string $path path to file
196+
* @return int
197+
*/
198+
protected function ocmPermissions2ncPermissions(string $ocmPermissions, string $path): int
199+
{
200+
}
80201

81-
public function free_space(string $path): int|float|false {
82-
}
202+
/**
203+
* Calculate the default permissions in case no permissions are provided
204+
*/
205+
protected function getDefaultPermissions(string $path): int
206+
{
207+
}
208+
209+
#[\Override]
210+
public function free_space(string $path): int|float|false
211+
{
212+
}
83213
}

tests/stubs/oca_user_ldap_mapping_abstractmapping.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
66
* SPDX-License-Identifier: AGPL-3.0-only
77
*/
8+
89
namespace OCA\User_LDAP\Mapping;
910

1011
use Doctrine\DBAL\Exception;
11-
use OCP\DB\IPreparedStatement;
1212
use OCP\DB\QueryBuilder\IQueryBuilder;
1313
use OCP\IAppConfig;
1414
use OCP\ICache;
@@ -28,9 +28,7 @@ abstract class AbstractMapping {
2828
*
2929
* @return string
3030
*/
31-
abstract protected function getTableName(bool $includePrefix = true)
32-
{
33-
}
31+
abstract protected function getTableName(bool $includePrefix = true);
3432

3533
/**
3634
* A month worth of cache time for as good as never changing mapping data.
@@ -93,17 +91,6 @@ public function isColNameValid($col)
9391
*/
9492
protected function getXbyY($fetchCol, $compareCol, $search)
9593
{
96-
}
97-
98-
/**
99-
* Performs a DELETE or UPDATE query to the database.
100-
*
101-
* @param IPreparedStatement $statement
102-
* @param array $parameters
103-
* @return bool true if at least one row was modified, false otherwise
104-
*/
105-
protected function modify(IPreparedStatement $statement, $parameters)
106-
{
10794
}
10895

10996
/**

tests/stubs/oca_user_ldap_mapping_usermapping.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ public function __construct(IDBConnection $dbc, ICacheFactory $cacheFactory, IAp
3333
/**
3434
* @throws HintException
3535
*/
36-
public function map($fdn, $name, $uuid): bool
36+
#[\Override]
37+
public function map($fdn, $name, $uuid): bool
3738
{
3839
}
3940

4041
/**
4142
* returns the DB table name which holds the mappings
4243
* @return string
4344
*/
44-
protected function getTableName(bool $includePrefix = true)
45+
#[\Override]
46+
protected function getTableName(bool $includePrefix = true)
4547
{
4648
}
4749
}

tests/stubs/stecman_component_symfony_console_bashcompletion_completion_completionawareinterface.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ interface CompletionAwareInterface
1414
* @param CompletionContext $context
1515
* @return array
1616
*/
17-
public function completeOptionValues($optionName, CompletionContext $context)
18-
{
19-
}
17+
public function completeOptionValues($optionName, CompletionContext $context);
2018

2119
/**
2220
* Return possible values for the named argument
@@ -25,7 +23,5 @@ public function completeOptionValues($optionName, CompletionContext $context)
2523
* @param CompletionContext $context
2624
* @return array
2725
*/
28-
public function completeArgumentValues($argumentName, CompletionContext $context)
29-
{
30-
}
26+
public function completeArgumentValues($argumentName, CompletionContext $context);
3127
}

0 commit comments

Comments
 (0)