Skip to content

Commit

Permalink
Do not build a massive array of users when giving each user an addres…
Browse files Browse the repository at this point in the history
…s book from their profile. Instead, get one userId at a time.
  • Loading branch information
perlDreamer committed Mar 11, 2012
1 parent 9a09ec0 commit 4f85ad5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 6 additions & 4 deletions docs/upgrades/upgrade_7.10.21-7.10.22.pl
Expand Up @@ -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 (
Expand Down
9 changes: 5 additions & 4 deletions docs/upgrades/upgrade_7.9.34-7.10.22.pl
Expand Up @@ -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 (
Expand Down

0 comments on commit 4f85ad5

Please sign in to comment.