ChunkedUploadConfig.php 851 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files\Service;
  8. use OCP\IConfig;
  9. use OCP\Server;
  10. class ChunkedUploadConfig {
  11. private const KEY_MAX_SIZE = 'files.chunked_upload.max_size';
  12. private const KEY_MAX_PARALLEL_COUNT = 'files.chunked_upload.max_parallel_count';
  13. public static function getMaxChunkSize(): int {
  14. return Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_SIZE, 100 * 1024 * 1024);
  15. }
  16. public static function setMaxChunkSize(int $maxChunkSize): void {
  17. Server::get(IConfig::class)->setSystemValue(self::KEY_MAX_SIZE, $maxChunkSize);
  18. }
  19. public static function getMaxParallelCount(): int {
  20. return Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_PARALLEL_COUNT, 5);
  21. }
  22. }