aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Migration/Version2003Date20241021095629.php
blob: 30d05fa12ad827315dc3208b14679a86cee9b27d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCA\Files\Migration;

use Closure;
use OCA\Files\Service\ChunkedUploadConfig;
use OCP\DB\ISchemaWrapper;
use OCP\IConfig;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use OCP\Server;

class Version2003Date20241021095629 extends SimpleMigrationStep {
	/**
	 * @param IOutput $output
	 * @param Closure(): ISchemaWrapper $schemaClosure
	 * @param array $options
	 */
	public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
		$maxChunkSize = Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size');
		if ($maxChunkSize === '') {
			// Skip if no value was configured before
			return;
		}

		ChunkedUploadConfig::setMaxChunkSize((int)$maxChunkSize);
		Server::get(IConfig::class)->deleteAppValue('files', 'max_chunk_size');
	}
}