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

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

@ -66,7 +66,7 @@ class Session {
public function getPrivateKey() { public function getPrivateKey() {
$key = $this->session->get('privateKey'); $key = $this->session->get('privateKey');
if (is_null($key)) { 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; return $key;
} }

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

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

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

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

@ -85,8 +85,8 @@ class UserStoragesController extends StoragesController {
* {@inheritdoc} * {@inheritdoc}
*/ */
#[NoAdminRequired] #[NoAdminRequired]
public function show(int $id, $testOnly = true) { public function show(int $id) {
return parent::show($id, $testOnly); return parent::show($id);
} }
/** /**
@ -152,7 +152,6 @@ class UserStoragesController extends StoragesController {
* @param string $authMechanism authentication mechanism identifier * @param string $authMechanism authentication mechanism identifier
* @param array $backendOptions backend-specific options * @param array $backendOptions backend-specific options
* @param array $mountOptions backend-specific mount 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 * @return DataResponse
*/ */
@ -165,7 +164,6 @@ class UserStoragesController extends StoragesController {
$authMechanism, $authMechanism,
$backendOptions, $backendOptions,
$mountOptions, $mountOptions,
$testOnly = true,
) { ) {
$storage = $this->createStorage( $storage = $this->createStorage(
$mountPoint, $mountPoint,
@ -195,7 +193,7 @@ class UserStoragesController extends StoragesController {
); );
} }
$this->updateStorageStatus($storage, $testOnly); $this->updateStorageStatus($storage);
return new DataResponse( return new DataResponse(
$storage->jsonSerialize(true), $storage->jsonSerialize(true),

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

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

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

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

@ -8,6 +8,7 @@
namespace OC\Files; namespace OC\Files;
use OC\Files\Mount\MountPoint; use OC\Files\Mount\MountPoint;
use OC\Files\Storage\StorageFactory;
use OC\User\NoUserException; use OC\User\NoUserException;
use OCP\Cache\CappedMemoryCache; use OCP\Cache\CappedMemoryCache;
use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventDispatcher;
@ -178,7 +179,9 @@ class Filesystem {
} }
$mounts = self::getMountManager()->getAll(); $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 // do not re-wrap if storage with this name already existed
return; return;
} }

@ -30,7 +30,7 @@ class NullStorage extends Common {
} }
public function opendir(string $path): IteratorDirectory { public function opendir(string $path): IteratorDirectory {
return new IteratorDirectory([]); return new IteratorDirectory();
} }
public function is_dir(string $path): bool { 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('expiration', $qb->createNamedParameter($expirationDate, IQueryBuilder::PARAM_DATETIME_MUTABLE))
->set('note', $qb->createNamedParameter($share->getNote())) ->set('note', $qb->createNamedParameter($share->getNote()))
->set('label', $qb->createNamedParameter($share->getLabel())) ->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(); ->executeStatement();
} }

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

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