Merge pull request #53944 from nextcloud/chore/too-many-arguments

pull/53992/head
Kate 2025-07-28 10:49:52 +07:00 committed by GitHub
commit aca5361e86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 33 additions and 79 deletions

@ -156,7 +156,7 @@ class FilesReportPlugin extends ServerPlugin {
// to user backends. I.e. the final result may return more results than requested.
$resultNodes = $this->processFilterRulesForFileNodes($filterRules, $limit ?? null, $offset ?? null);
} catch (TagNotFoundException $e) {
throw new PreconditionFailed('Cannot filter by non-existing tag', 0, $e);
throw new PreconditionFailed('Cannot filter by non-existing tag');
}
$results = [];

@ -184,7 +184,7 @@ class ServerFactory {
!$this->config->getSystemValue('debug', false)
)
);
$server->addPlugin(new QuotaPlugin($view, true));
$server->addPlugin(new QuotaPlugin($view));
$server->addPlugin(new ChecksumUpdatePlugin());
// Allow view-only plugin for webdav requests

@ -66,7 +66,7 @@ class Session {
public function getPrivateKey() {
$key = $this->session->get('privateKey');
if (is_null($key)) {
throw new PrivateKeyMissingException('please try to log-out and log-in again', 0);
throw new PrivateKeyMissingException('please try to log-out and log-in again');
}
return $key;
}

@ -97,7 +97,6 @@ class Verify extends Base {
MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false
)
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {

@ -133,7 +133,6 @@ class GlobalStoragesController extends StoragesController {
* @param array $applicableUsers users for which to mount the storage
* @param array $applicableGroups groups for which to mount the storage
* @param int $priority priority
* @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
@ -148,7 +147,6 @@ class GlobalStoragesController extends StoragesController {
$applicableUsers,
$applicableGroups,
$priority,
$testOnly = true,
) {
$storage = $this->createStorage(
$mountPoint,
@ -181,7 +179,7 @@ class GlobalStoragesController extends StoragesController {
);
}
$this->updateStorageStatus($storage, $testOnly);
$this->updateStorageStatus($storage);
return new DataResponse(
$storage->jsonSerialize(true),

@ -213,9 +213,8 @@ abstract class StoragesController extends Controller {
* on whether the remote storage is available or not.
*
* @param StorageConfig $storage storage configuration
* @param bool $testOnly whether to storage should only test the connection or do more things
*/
protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) {
protected function updateStorageStatus(StorageConfig &$storage) {
try {
$this->manipulateStorageConfig($storage);
@ -226,8 +225,6 @@ abstract class StoragesController extends Controller {
MountConfig::getBackendStatus(
$backend->getStorageClass(),
$storage->getBackendOptions(),
false,
$testOnly
)
);
} catch (InsufficientDataForMeaningfulAnswerException $e) {
@ -268,15 +265,14 @@ abstract class StoragesController extends Controller {
* Get an external storage entry.
*
* @param int $id storage id
* @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
public function show(int $id, $testOnly = true) {
public function show(int $id) {
try {
$storage = $this->service->getStorage($id);
$this->updateStorageStatus($storage, $testOnly);
$this->updateStorageStatus($storage);
} catch (NotFoundException $e) {
return new DataResponse(
[

@ -97,15 +97,14 @@ class UserGlobalStoragesController extends StoragesController {
* Get an external storage entry.
*
* @param int $id storage id
* @param bool $testOnly whether to storage should only test the connection or do more things
* @return DataResponse
*/
#[NoAdminRequired]
public function show($id, $testOnly = true) {
public function show($id) {
try {
$storage = $this->service->getStorage($id);
$this->updateStorageStatus($storage, $testOnly);
$this->updateStorageStatus($storage);
} catch (NotFoundException $e) {
return new DataResponse(
[
@ -133,7 +132,6 @@ class UserGlobalStoragesController extends StoragesController {
*
* @param int $id storage id
* @param array $backendOptions backend-specific options
* @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
@ -142,7 +140,6 @@ class UserGlobalStoragesController extends StoragesController {
public function update(
$id,
$backendOptions,
$testOnly = true,
) {
try {
$storage = $this->service->getStorage($id);
@ -167,7 +164,7 @@ class UserGlobalStoragesController extends StoragesController {
);
}
$this->updateStorageStatus($storage, $testOnly);
$this->updateStorageStatus($storage);
$this->sanitizeStorage($storage);
return new DataResponse(

@ -85,8 +85,8 @@ class UserStoragesController extends StoragesController {
* {@inheritdoc}
*/
#[NoAdminRequired]
public function show(int $id, $testOnly = true) {
return parent::show($id, $testOnly);
public function show(int $id) {
return parent::show($id);
}
/**
@ -152,7 +152,6 @@ class UserStoragesController extends StoragesController {
* @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options
* @param array $mountOptions backend-specific mount options
* @param bool $testOnly whether to storage should only test the connection or do more things
*
* @return DataResponse
*/
@ -165,7 +164,6 @@ class UserStoragesController extends StoragesController {
$authMechanism,
$backendOptions,
$mountOptions,
$testOnly = true,
) {
$storage = $this->createStorage(
$mountPoint,
@ -195,7 +193,7 @@ class UserStoragesController extends StoragesController {
);
}
$this->updateStorageStatus($storage, $testOnly);
$this->updateStorageStatus($storage);
return new DataResponse(
$storage->jsonSerialize(true),

@ -76,7 +76,7 @@ class MountConfig {
* @return int see self::STATUS_*
* @throws \Exception
*/
public static function getBackendStatus($class, $options, $isPersonal, $testOnly = true) {
public static function getBackendStatus($class, $options) {
if (self::$skipTest) {
return StorageNotAvailableException::STATUS_SUCCESS;
}
@ -93,7 +93,7 @@ class MountConfig {
$storage = new $class($options);
try {
$result = $storage->test($isPersonal, $testOnly);
$result = $storage->test();
$storage->setAvailability($result);
if ($result) {
return StorageNotAvailableException::STATUS_SUCCESS;

@ -688,15 +688,9 @@
</MoreSpecificReturnType>
</file>
<file src="apps/dav/lib/Connector/Sabre/FilesReportPlugin.php">
<InvalidArgument>
<code><![CDATA[0]]></code>
</InvalidArgument>
<InvalidNullableReturnType>
<code><![CDATA[bool]]></code>
</InvalidNullableReturnType>
<TooManyArguments>
<code><![CDATA[new PreconditionFailed('Cannot filter by non-existing tag', 0, $e)]]></code>
</TooManyArguments>
<UndefinedClass>
<code><![CDATA[Circles]]></code>
</UndefinedClass>
@ -753,9 +747,6 @@
<code><![CDATA[getL10NFactory]]></code>
<code><![CDATA[getUserFolder]]></code>
</DeprecatedMethod>
<TooManyArguments>
<code><![CDATA[new QuotaPlugin($view, true)]]></code>
</TooManyArguments>
</file>
<file src="apps/dav/lib/Connector/Sabre/ShareTypeList.php">
<InvalidArgument>
@ -1177,11 +1168,6 @@
<code><![CDATA[setAppValue]]></code>
</DeprecatedMethod>
</file>
<file src="apps/encryption/lib/Session.php">
<TooManyArguments>
<code><![CDATA[new PrivateKeyMissingException('please try to log-out and log-in again', 0)]]></code>
</TooManyArguments>
</file>
<file src="apps/encryption/lib/Settings/Admin.php">
<DeprecatedMethod>
<code><![CDATA[getAppValue]]></code>
@ -1511,9 +1497,6 @@
<code><![CDATA[setIV]]></code>
<code><![CDATA[setKey]]></code>
</InternalMethod>
<TooManyArguments>
<code><![CDATA[test]]></code>
</TooManyArguments>
</file>
<file src="apps/files_external/lib/Service/BackendService.php">
<DeprecatedClass>
@ -2901,9 +2884,6 @@
<FalsableReturnStatement>
<code><![CDATA[$this->appConfig->getValues($app, false)]]></code>
</FalsableReturnStatement>
<TooManyArguments>
<code><![CDATA[getFilteredValues]]></code>
</TooManyArguments>
</file>
<file src="core/Command/Db/AddMissingPrimaryKeys.php">
<DeprecatedMethod>
@ -3314,11 +3294,6 @@
<code><![CDATA[$key]]></code>
</MoreSpecificImplementedParamType>
</file>
<file src="lib/private/App/AppStore/Fetcher/Fetcher.php">
<TooManyArguments>
<code><![CDATA[fetch]]></code>
</TooManyArguments>
</file>
<file src="lib/private/App/DependencyAnalyzer.php">
<InvalidNullableReturnType>
<code><![CDATA[bool]]></code>
@ -3775,9 +3750,6 @@
<code><![CDATA[Mount\MountPoint[]]]></code>
<code><![CDATA[\OC\Files\Storage\Storage|null]]></code>
</MoreSpecificReturnType>
<TooManyArguments>
<code><![CDATA[addStorageWrapper]]></code>
</TooManyArguments>
</file>
<file src="lib/private/Files/Mount/MountPoint.php">
<UndefinedInterfaceMethod>
@ -4071,11 +4043,6 @@
<code><![CDATA[getIncomplete]]></code>
</InvalidReturnType>
</file>
<file src="lib/private/Lockdown/Filesystem/NullStorage.php">
<TooManyArguments>
<code><![CDATA[new IteratorDirectory([])]]></code>
</TooManyArguments>
</file>
<file src="lib/private/Lockdown/LockdownManager.php">
<InvalidFunctionCall>
<code><![CDATA[$callback()]]></code>
@ -4283,9 +4250,6 @@
<code><![CDATA[$share->getId()]]></code>
<code><![CDATA[(int)$data['id']]]></code>
</InvalidArgument>
<TooManyArguments>
<code><![CDATA[set]]></code>
</TooManyArguments>
<UndefinedInterfaceMethod>
<code><![CDATA[getParent]]></code>
</UndefinedInterfaceMethod>
@ -4294,9 +4258,6 @@
<InvalidArgument>
<code><![CDATA[$id]]></code>
</InvalidArgument>
<TooManyArguments>
<code><![CDATA[update]]></code>
</TooManyArguments>
<UndefinedClass>
<code><![CDATA[\OCA\Circles\Api\v1\Circles]]></code>
</UndefinedClass>

@ -125,7 +125,7 @@ class ListConfigs extends Base {
*/
protected function getAppConfigs(string $app, bool $noSensitiveValues) {
if ($noSensitiveValues) {
return $this->appConfig->getFilteredValues($app, false);
return $this->appConfig->getFilteredValues($app);
} else {
return $this->appConfig->getValues($app, false);
}

@ -56,7 +56,7 @@ abstract class Fetcher {
*
* @return array
*/
protected function fetch($ETag, $content) {
protected function fetch($ETag, $content, $allowUnstable = false) {
$appstoreenabled = $this->config->getSystemValueBool('appstoreenabled', true);
if ((int)$this->config->getAppValue('settings', 'appstore-fetcher-lastFailure', '0') > time() - self::RETRY_AFTER_FAILURE_SECONDS) {
return [];

@ -8,6 +8,7 @@
namespace OC\Files;
use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
use OC\User\NoUserException;
use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher;
@ -178,7 +179,9 @@ class Filesystem {
}
$mounts = self::getMountManager()->getAll();
if (!self::getLoader()->addStorageWrapper($wrapperName, $wrapper, $priority, $mounts)) {
/** @var StorageFactory $loader */
$loader = self::getLoader();
if (!$loader->addStorageWrapper($wrapperName, $wrapper, $priority, $mounts)) {
// do not re-wrap if storage with this name already existed
return;
}

@ -30,7 +30,7 @@ class NullStorage extends Common {
}
public function opendir(string $path): IteratorDirectory {
return new IteratorDirectory([]);
return new IteratorDirectory();
}
public function is_dir(string $path): bool {

@ -284,7 +284,7 @@ class DefaultShareProvider implements IShareProviderWithNotification, IShareProv
->set('expiration', $qb->createNamedParameter($expirationDate, IQueryBuilder::PARAM_DATETIME_MUTABLE))
->set('note', $qb->createNamedParameter($share->getNote()))
->set('label', $qb->createNamedParameter($share->getLabel()))
->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0), IQueryBuilder::PARAM_INT)
->set('hide_download', $qb->createNamedParameter($share->getHideDownload() ? 1 : 0, IQueryBuilder::PARAM_INT))
->executeStatement();
}

@ -12,6 +12,7 @@ use OC\KnownUser\KnownUserService;
use OC\Share20\Exception\ProviderException;
use OCA\Files_Sharing\AppInfo\Application;
use OCA\Files_Sharing\SharedStorage;
use OCA\ShareByMail\ShareByMailProvider;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\File;
use OCP\Files\Folder;
@ -869,6 +870,7 @@ class Manager implements IManager {
// Now update the share!
$provider = $this->factory->getProviderForType($share->getShareType());
if ($share->getShareType() === IShare::TYPE_EMAIL) {
/** @var ShareByMailProvider $provider */
$share = $provider->update($share, $plainTextPassword);
} else {
$share = $provider->update($share);

@ -70,10 +70,10 @@ class ListConfigsTest extends TestCase {
],
// app config
[
['files', false, [
['files', [
'enabled' => 'yes',
]],
['core', false, [
['core', [
'global_cache_gc_lastrun' => '1430388388',
]],
],
@ -150,10 +150,10 @@ class ListConfigsTest extends TestCase {
],
// app config
[
['files', false, [
['files', [
'enabled' => 'yes',
]],
['core', false, [
['core', [
'global_cache_gc_lastrun' => '1430388388',
]],
],
@ -185,10 +185,10 @@ class ListConfigsTest extends TestCase {
],
// app config
[
['files', false, [
['files', [
'enabled' => 'yes',
]],
['core', false, [
['core', [
'global_cache_gc_lastrun' => '1430388388',
]],
],
@ -213,10 +213,10 @@ class ListConfigsTest extends TestCase {
],
// app config
[
['files', false, [
['files', [
'enabled' => 'yes',
]],
['core', false, [
['core', [
'global_cache_gc_lastrun' => '1430388388',
]],
],