diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2015-02-06 17:37:05 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2015-02-06 17:51:40 +0100 |
commit | 15b2d33599e28477a712a9dc788f2b64523a71a9 (patch) | |
tree | 8b25d630c2b1987c936819d0d3df965d4668699b /apps | |
parent | 80e38b84dccde44c40109e9721fac00984f43ef7 (diff) | |
download | nextcloud-server-15b2d33599e28477a712a9dc788f2b64523a71a9.tar.gz nextcloud-server-15b2d33599e28477a712a9dc788f2b64523a71a9.zip |
always specify limit, except you do like questionable surprises
always specify limit, except you do like questionable surprises, part 2
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_encryption/command/migratekeys.php | 12 | ||||
-rw-r--r-- | apps/files_encryption/lib/migration.php | 13 |
2 files changed, 18 insertions, 7 deletions
diff --git a/apps/files_encryption/command/migratekeys.php b/apps/files_encryption/command/migratekeys.php index 200d7367da6..d6db1f70892 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 <info>$name</info>"); - $users = $backend->getUsers(); - foreach ($users as $user) { + + $limit = 500; + $offset = 0; + do { + $users = $backend->getUsers('', $limit, $offset); + foreach ($users as $user) { $output->writeln(" <info>$user</info>"); $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 cf5552f84ac..5d16428a758 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() { |