]> source.dussan.org Git - nextcloud-server.git/commitdiff
always specify limit, except you do like questionable surprises
authorArthur Schiwon <blizzz@owncloud.com>
Fri, 6 Feb 2015 16:37:05 +0000 (17:37 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Fri, 6 Feb 2015 16:51:40 +0000 (17:51 +0100)
always specify limit, except you do like questionable surprises, part 2

apps/files_encryption/command/migratekeys.php
apps/files_encryption/lib/migration.php

index 200d7367da6e7c43ce57886f008b7b28dfbda429..d6db1f70892090250a06631c2fa1d33e0bedf6a6 100644 (file)
@@ -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);
                        }
                }
 
index cf5552f84ac2241ba6714d75454a64ca0184e8fc..5d16428a75894a3c587fa6e0bf6d4cb146b8bee8 100644 (file)
@@ -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() {