Mercurial > eagle-eye
diff scan.pl @ 88:0fa9cd836e1e
rewrited the viewIsland function.
author | "Rex Tsai <chihchun@kalug.linux.org.tw>" |
---|---|
date | Sun, 26 Oct 2008 16:12:03 +0800 |
parents | 96ee35378696 |
children | 86402d28544f |
line wrap: on
line diff
--- a/scan.pl Sun Oct 26 15:02:06 2008 +0800 +++ b/scan.pl Sun Oct 26 16:12:03 2008 +0800 @@ -52,22 +52,24 @@ { my $users = shift; - foreach my $h_user (values(%{$users})) - { - # print(Dumper($user)); - printf("Saving user %s\n", $h_user->{'name'}); - $h_user->{'time'} = time; - my $user; - if($user = Ikariam::User->retrieve($h_user->{id})) + if(defined($users)) { + foreach my $h_user (values(%{$users})) { - foreach my $i (keys(%$h_user)) { - # eval($c->$i($h_user->{$i})); - $user->set($i => $h_user->{$i}); + # print(Dumper($user)); + printf("Saving user %s\n", $h_user->{'name'}); + $h_user->{'time'} = time; + my $user; + if($user = Ikariam::User->retrieve($h_user->{id})) + { + foreach my $i (keys(%$h_user)) { + # eval($c->$i($h_user->{$i})); + $user->set($i => $h_user->{$i}); + } + } else { + $user = Ikariam::User->insert($h_user); } - } else { - $user = Ikariam::User->insert($h_user); + $user->update(); } - $user->update(); } }