Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

do not use NOW() -- it precludes SQLite

  • Loading branch information...
commit cbf12e3480d893e07b5bfb05949216405588a363 1 parent 1112480
@rjbs rjbs authored
Showing with 21 additions and 9 deletions.
  1. +21 −9 lib/PAUSE/mldistwatch.pm
View
30 lib/PAUSE/mldistwatch.pm
@@ -29,6 +29,7 @@ use PAUSE ();
use PAUSE::MailAddress ();
use Safe;
use Text::Format;
+use Time::Piece;
{
my $HAVE_YAML = eval { require YAML; 1; };
my $HAVE_YAML_SYCK = eval { require YAML::Syck; 1; };
@@ -282,13 +283,19 @@ sub set_ustatus_to_active {
return unless @new_active_users;
$self->verbose(2,"Info: new_active_users[@new_active_users]");
my $sth = $db->prepare("UPDATE users
-SET ustatus='active', ustatus_ch=NOW() WHERE ustatus<>'nologin' AND userid=?");
+SET ustatus='active', ustatus_ch=? WHERE ustatus<>'nologin' AND userid=?");
for my $user (@new_active_users) {
- $sth->execute($user);
+ $sth->execute($self->_now_string, $user);
}
$sth->finish;
}
+sub _now_string {
+ my ($self) = @_;
+ my $time = Time::Piece->new;
+ return join q{ }, $time->ymd, $time->hms;
+}
+
sub connect {
my $self = shift;
return $self->{DBH} if $self->{DBH};
@@ -2208,10 +2215,13 @@ Please contact modules\@perl.org if there are any open questions.
}
my $dist = $self->{DIST};
my $dbh = $self->connect;
- my $rows_affected = $dbh->do("UPDATE distmtimes
- SET indexing_at=NOW()
- WHERE dist='$dist'
- AND indexing_at IS NULL");
+ my $rows_affected = $dbh->do(
+ "UPDATE distmtimes SET indexing_at=?
+ WHERE dist='$dist'
+ AND indexing_at IS NULL",
+ undef,
+ $self->_now_string,
+ );
return 1 if $rows_affected > 0;
my $sth = $dbh->prepare("SELECT * FROM distmtimes WHERE dist=?");
$sth->execute($dist);
@@ -2236,9 +2246,11 @@ Please contact modules\@perl.org if there are any open questions.
my($self) = @_;
my $dist = $self->{DIST};
my $dbh = $self->connect;
- my $rows_affected = $dbh->do("UPDATE distmtimes
- SET indexed_at=NOW()
- WHERE dist='$dist'");
+ my $rows_affected = $dbh->do(
+ "UPDATE distmtimes SET indexed_at=? WHERE dist='$dist'",
+ undef,
+ $self->_now_string,
+ );
$rows_affected > 0;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.