diff options
author | Perl Tidy <perltidy@bugzilla.org> | 2018-12-05 21:38:52 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-12-05 23:49:08 +0100 |
commit | 8ec8da0491ad89604700b3e29a227966f6d84ba1 (patch) | |
tree | 9d270f173330ca19700e0ba9f2ee931300646de1 /extensions/UserProfile/bin/update.pl | |
parent | a7bb5a65b71644d9efce5fed783ed545b9336548 (diff) | |
download | bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.gz bugzilla-8ec8da0491ad89604700b3e29a227966f6d84ba1.tar.xz |
no bug - reformat all the code using the new perltidy rules
Diffstat (limited to 'extensions/UserProfile/bin/update.pl')
-rwxr-xr-x | extensions/UserProfile/bin/update.pl | 62 |
1 files changed, 28 insertions, 34 deletions
diff --git a/extensions/UserProfile/bin/update.pl b/extensions/UserProfile/bin/update.pl index 4d704a1f0..bdbcef329 100755 --- a/extensions/UserProfile/bin/update.pl +++ b/extensions/UserProfile/bin/update.pl @@ -26,56 +26,50 @@ my $user_ids; my $verbose = grep { $_ eq '-v' } @ARGV; $user_ids = $dbh->selectcol_arrayref( - "SELECT user_id + "SELECT user_id FROM profiles_statistics_recalc - ORDER BY user_id", - { Slice => {} } + ORDER BY user_id", {Slice => {}} ); if (@$user_ids) { - print "recalculating last_user_activity\n"; - my ($count, $total) = (0, scalar(@$user_ids)); - foreach my $user_id (@$user_ids) { - if ($verbose) { - $count++; - my $login = user_id_to_login($user_id); - print "$count/$total $login ($user_id)\n"; - } - $dbh->do( - "UPDATE profiles - SET last_activity_ts = ?, - last_statistics_ts = NULL - WHERE userid = ?", - undef, - last_user_activity($user_id), - $user_id - ); - Bugzilla->memcached->clear({ table => 'profiles', id => $user_id }); + print "recalculating last_user_activity\n"; + my ($count, $total) = (0, scalar(@$user_ids)); + foreach my $user_id (@$user_ids) { + if ($verbose) { + $count++; + my $login = user_id_to_login($user_id); + print "$count/$total $login ($user_id)\n"; } $dbh->do( - "DELETE FROM profiles_statistics_recalc WHERE " . $dbh->sql_in('user_id', $user_ids) + "UPDATE profiles + SET last_activity_ts = ?, + last_statistics_ts = NULL + WHERE userid = ?", undef, last_user_activity($user_id), $user_id ); + Bugzilla->memcached->clear({table => 'profiles', id => $user_id}); + } + $dbh->do("DELETE FROM profiles_statistics_recalc WHERE " + . $dbh->sql_in('user_id', $user_ids)); } $user_ids = $dbh->selectcol_arrayref( - "SELECT userid + "SELECT userid FROM profiles WHERE last_activity_ts IS NOT NULL AND (last_statistics_ts IS NULL OR last_activity_ts > last_statistics_ts) - ORDER BY userid", - { Slice => {} } + ORDER BY userid", {Slice => {}} ); if (@$user_ids) { - $verbose && print "updating statistics\n"; - my ($count, $total) = (0, scalar(@$user_ids)); - foreach my $user_id (@$user_ids) { - if ($verbose) { - $count++; - my $login = user_id_to_login($user_id); - print "$count/$total $login ($user_id)\n"; - } - update_statistics_by_user($user_id); + $verbose && print "updating statistics\n"; + my ($count, $total) = (0, scalar(@$user_ids)); + foreach my $user_id (@$user_ids) { + if ($verbose) { + $count++; + my $login = user_id_to_login($user_id); + print "$count/$total $login ($user_id)\n"; } + update_statistics_by_user($user_id); + } } |