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.
This commit is contained in:
parent
9a09ec0447
commit
4f85ad56e6
2 changed files with 11 additions and 8 deletions
|
|
@ -63,12 +63,14 @@ sub addLinkedProfileAddress {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tAdding linked profile addresses for existing users... " unless $quiet;
|
print "\tAdding linked profile addresses for existing users... " unless $quiet;
|
||||||
|
|
||||||
my $users = $session->db->buildArrayRef( q{
|
my $users = $session->db->read( q{ select userId from users } );
|
||||||
select userId from users where userId not in ('1','3')
|
|
||||||
} );
|
|
||||||
|
|
||||||
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
|
#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);
|
my $u = WebGUI::User->new($session,$userId);
|
||||||
#skip if user does not have any homeAddress fields filled in
|
#skip if user does not have any homeAddress fields filled in
|
||||||
next unless (
|
next unless (
|
||||||
|
|
|
||||||
|
|
@ -433,14 +433,15 @@ sub addLinkedProfileAddress {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tAdding linked profile addresses for existing users... " unless $quiet;
|
print "\tAdding linked profile addresses for existing users... " unless $quiet;
|
||||||
|
|
||||||
my $users = $session->db->buildArrayRef( q{
|
my $users = $session->db->read( q{ select userId from users } );
|
||||||
select userId from users where userId not in ('1','3')
|
|
||||||
} );
|
|
||||||
|
|
||||||
use WebGUI::User;
|
use WebGUI::User;
|
||||||
use WebGUI::Shop::AddressBook;
|
use WebGUI::Shop::AddressBook;
|
||||||
foreach my $userId (@$users) {
|
|
||||||
|
while (my ($userId) = $users->array()) {
|
||||||
#check to see if there is user profile information available
|
#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);
|
my $u = WebGUI::User->new($session,$userId);
|
||||||
#skip if user does not have any homeAddress fields filled in
|
#skip if user does not have any homeAddress fields filled in
|
||||||
next unless (
|
next unless (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue