Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

avoid another mysql function

  • Loading branch information...
commit d6c39c27e013f70c609e0a3b01f2d9544e40d8c3 1 parent 0773671
Ricardo Signes authored August 13, 2011

Showing 1 changed file with 15 additions and 5 deletions. Show diff stats Hide diff stats

  1. 20  lib/PAUSE/mldistwatch.pm
20  lib/PAUSE/mldistwatch.pm
@@ -291,10 +291,15 @@ SET ustatus='active', ustatus_ch=? WHERE ustatus<>'nologin' AND userid=?");
291 291
     $sth->finish;
292 292
 }
293 293
 
  294
+sub _time_string {
  295
+  my ($self, $s) = @_;
  296
+  my $time = Time::Piece->new($s);
  297
+  return join q{ }, $time->ymd, $time->hms;
  298
+}
  299
+
294 300
 sub _now_string {
295 301
   my ($self) = @_;
296  
-  my $time = Time::Piece->new;
297  
-  return join q{ }, $time->ymd, $time->hms;
  302
+  return $self->_time_string(time);
298 303
 }
299 304
 
300 305
 sub connect {
@@ -1410,9 +1415,14 @@ sub mlroot {
1410 1415
                 }
1411 1416
             }
1412 1417
             if ($mtime > $otherts) {
1413  
-                $dbh->do(qq{UPDATE distmtimes
1414  
-                     SET distmtime='$mtime', distmdatetime=from_unixtime('$mtime')
1415  
-                   WHERE dist='$dist'});
  1418
+                $dbh->do(
  1419
+                  qq{UPDATE distmtimes SET distmtime=?, distmdatetime=?
  1420
+                   WHERE dist=?},
  1421
+                   undef,
  1422
+                   $mtime,
  1423
+                   $self->_time_string($mtime),
  1424
+                   $dist,
  1425
+                );
1416 1426
                 $self->verbose(1,"DEBUG5: mtime assigned [$mtime] to dist[$dist]\n");
1417 1427
                 return 1;
1418 1428
             }

0 notes on commit d6c39c2

Please sign in to comment.
Something went wrong with that request. Please try again.