-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(settings): Calculate correct default quota option sizes
Signed-off-by: provokateurin <kate@provokateurin.de>
- Loading branch information
1 parent
8b42117
commit 2b5657d
Showing
3 changed files
with
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
namespace OCA\GroupFolders\Migration; | ||
|
||
use OCA\GroupFolders\Folder\FolderManager; | ||
use OCP\DB\Exception; | ||
use OCP\Migration\IOutput; | ||
use OCP\Migration\IRepairStep; | ||
|
||
class WrongDefaultQuotaRepairStep implements IRepairStep { | ||
public function __construct( | ||
private FolderManager $manager, | ||
) { | ||
|
||
} | ||
|
||
public function getName() { | ||
return 'Adjust Groupfolders with wrong default quotas'; | ||
} | ||
|
||
/** | ||
* @param IOutput $output | ||
* @throws Exception | ||
*/ | ||
public function run(IOutput $output): void { | ||
foreach ($this->manager->getAllFolders() as $id => $folder) { | ||
$quota = $folder['quota']; | ||
|
||
$changed = false; | ||
if ($quota === 1073741274) { | ||
$quota = 1024 ** 3; | ||
$changed = true; | ||
} elseif ($quota === 10737412742) { | ||
$quota = 1024 ** 3 * 10; | ||
$changed = true; | ||
} | ||
|
||
if ($changed) { | ||
$this->manager->setFolderQuota($id, $quota); | ||
} | ||
} | ||
} | ||
} |
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