diff --git a/apps/files_encryption/command/migratekeys.php b/apps/files_encryption/command/migratekeys.php
index 200d7367da..d6db1f7089 100644
--- a/apps/files_encryption/command/migratekeys.php
+++ b/apps/files_encryption/command/migratekeys.php
@@ -62,11 +62,17 @@ class MigrateKeys extends Command {
}
$output->writeln("Migrating keys for users on backend $name");
- $users = $backend->getUsers();
- foreach ($users as $user) {
+
+ $limit = 500;
+ $offset = 0;
+ do {
+ $users = $backend->getUsers('', $limit, $offset);
+ foreach ($users as $user) {
$output->writeln(" $user");
$migration->reorganizeFolderStructureForUser($user);
- }
+ }
+ $offset += $limit;
+ } while(count($users) >= $limit);
}
}
diff --git a/apps/files_encryption/lib/migration.php b/apps/files_encryption/lib/migration.php
index 8af633aeaf..7a036ade3f 100644
--- a/apps/files_encryption/lib/migration.php
+++ b/apps/files_encryption/lib/migration.php
@@ -42,10 +42,15 @@ class Migration {
public function reorganizeFolderStructure() {
$this->reorganizeSystemFolderStructure();
- $users = \OCP\User::getUsers();
- foreach ($users as $user) {
- $this->reorganizeFolderStructureForUser($user);
- }
+ $limit = 500;
+ $offset = 0;
+ do {
+ $users = \OCP\User::getUsers('', $limit, $offset);
+ foreach ($users as $user) {
+ $this->reorganizeFolderStructureForUser($user);
+ }
+ $offset += $limit;
+ } while(count($users) >= $limit);
}
public function reorganizeSystemFolderStructure() {