-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48758 from nextcloud/feat/files/chunked-upload-co…
…nfig-capabilities
- Loading branch information
Showing
9 changed files
with
115 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
apps/files/lib/Migration/Version2003Date20241021095629.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\Files\Service; | ||
|
||
use OCP\IConfig; | ||
use OCP\Server; | ||
|
||
class ChunkedUploadConfig { | ||
private const KEY_MAX_SIZE = 'files.chunked_upload.max_size'; | ||
private const KEY_MAX_PARALLEL_COUNT = 'files.chunked_upload.max_parallel_count'; | ||
|
||
public static function getMaxChunkSize(): int { | ||
return Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_SIZE, 100 * 1024 * 1024); | ||
} | ||
|
||
public static function setMaxChunkSize(int $maxChunkSize): void { | ||
Server::get(IConfig::class)->setSystemValue(self::KEY_MAX_SIZE, $maxChunkSize); | ||
} | ||
|
||
public static function getMaxParallelCount(): int { | ||
return Server::get(IConfig::class)->getSystemValueInt(self::KEY_MAX_PARALLEL_COUNT, 5); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters