1
0

Version2003Date20241021095629.php 974 B

123456789101112131415161718192021222324252627282930313233343536
  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\Migration;
  8. use Closure;
  9. use OCA\Files\Service\ChunkedUploadConfig;
  10. use OCP\DB\ISchemaWrapper;
  11. use OCP\IConfig;
  12. use OCP\Migration\IOutput;
  13. use OCP\Migration\SimpleMigrationStep;
  14. use OCP\Server;
  15. class Version2003Date20241021095629 extends SimpleMigrationStep {
  16. /**
  17. * @param IOutput $output
  18. * @param Closure(): ISchemaWrapper $schemaClosure
  19. * @param array $options
  20. */
  21. public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
  22. $maxChunkSize = Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size');
  23. if ($maxChunkSize === '') {
  24. // Skip if no value was configured before
  25. return;
  26. }
  27. ChunkedUploadConfig::setMaxChunkSize((int)$maxChunkSize);
  28. Server::get(IConfig::class)->deleteAppValue('files', 'max_chunk_size');
  29. }
  30. }