Skip to content

Commit 4f85ad5

Browse files
committedMar 11, 2012
Do not build a massive array of users when giving each user an address book from their profile. Instead, get one userId at a time.
1 parent 9a09ec0 commit 4f85ad5

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed
 

‎docs/upgrades/upgrade_7.10.21-7.10.22.pl

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ sub addLinkedProfileAddress {
6363
my $session = shift;
6464
print "\tAdding linked profile addresses for existing users... " unless $quiet;
6565

66-
my $users = $session->db->buildArrayRef( q{
67-
select userId from users where userId not in ('1','3')
68-
} );
66+
my $users = $session->db->read( q{ select userId from users } );
6967

70-
foreach my $userId (@$users) {
68+
use WebGUI::User;
69+
use WebGUI::Shop::AddressBook;
70+
while (my ($userId) = $users->array()) {
7171
#check to see if there is user profile information available
72+
next if $userId eq '1' or $userId eq '3';
73+
last unless $userId;
7274
my $u = WebGUI::User->new($session,$userId);
7375
#skip if user does not have any homeAddress fields filled in
7476
next unless (

‎docs/upgrades/upgrade_7.9.34-7.10.22.pl

+5-4
Original file line numberDiff line numberDiff line change
@@ -433,14 +433,15 @@ sub addLinkedProfileAddress {
433433
my $session = shift;
434434
print "\tAdding linked profile addresses for existing users... " unless $quiet;
435435

436-
my $users = $session->db->buildArrayRef( q{
437-
select userId from users where userId not in ('1','3')
438-
} );
436+
my $users = $session->db->read( q{ select userId from users } );
439437

440438
use WebGUI::User;
441439
use WebGUI::Shop::AddressBook;
442-
foreach my $userId (@$users) {
440+
441+
while (my ($userId) = $users->array()) {
443442
#check to see if there is user profile information available
443+
next if $userId eq '1' or $userId eq '3';
444+
last unless $userId;
444445
my $u = WebGUI::User->new($session,$userId);
445446
#skip if user does not have any homeAddress fields filled in
446447
next unless (

0 commit comments

Comments
 (0)