Skip to content
Permalink
Browse files

Do not build a massive array of users when giving each user an addres…

…s book from their profile. Instead, get one userId at a time.
  • Loading branch information...
perlDreamer committed Mar 11, 2012
1 parent 9a09ec0 commit 4f85ad56e655510236769f6189134af23fd423a3
Showing with 11 additions and 8 deletions.
  1. +6 −4 docs/upgrades/upgrade_7.10.21-7.10.22.pl
  2. +5 −4 docs/upgrades/upgrade_7.9.34-7.10.22.pl
@@ -63,12 +63,14 @@ sub addLinkedProfileAddress {
my $session = shift;
print "\tAdding linked profile addresses for existing users... " unless $quiet;

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

foreach my $userId (@$users) {
use WebGUI::User;
use WebGUI::Shop::AddressBook;
while (my ($userId) = $users->array()) {
#check to see if there is user profile information available
next if $userId eq '1' or $userId eq '3';
last unless $userId;
my $u = WebGUI::User->new($session,$userId);
#skip if user does not have any homeAddress fields filled in
next unless (
@@ -433,14 +433,15 @@ sub addLinkedProfileAddress {
my $session = shift;
print "\tAdding linked profile addresses for existing users... " unless $quiet;

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

use WebGUI::User;
use WebGUI::Shop::AddressBook;
foreach my $userId (@$users) {

while (my ($userId) = $users->array()) {
#check to see if there is user profile information available
next if $userId eq '1' or $userId eq '3';
last unless $userId;
my $u = WebGUI::User->new($session,$userId);
#skip if user does not have any homeAddress fields filled in
next unless (

0 comments on commit 4f85ad5

Please sign in to comment.
You can’t perform that action at this time.