[Pkg-owncloud-commits] [owncloud] 27/34: always specify limit, except you do like questionable surprises

David Prévot taffit at moszumanska.debian.org
Wed Mar 11 15:49:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.0
in repository owncloud.

commit 15b2d33599e28477a712a9dc788f2b64523a71a9
Author: Arthur Schiwon <blizzz at owncloud.com>
Date:   Fri Feb 6 17:37:05 2015 +0100

    always specify limit, except you do like questionable surprises
    
    always specify limit, except you do like questionable surprises, part 2
---
 apps/files_encryption/command/migratekeys.php | 12 +++++++++---
 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 200d736..d6db1f7 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 cf5552f..5d16428 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() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list