]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Patch for bug 257303: convert lastused field in logincookies from timestamp to dateti...
authorjocuri%softhome.net <>
Thu, 9 Sep 2004 06:29:07 +0000 (06:29 +0000)
committerjocuri%softhome.net <>
Thu, 9 Sep 2004 06:29:07 +0000 (06:29 +0000)
Bugzilla/Auth/Login/WWW/CGI.pm
Bugzilla/Auth/Login/WWW/CGI/Cookie.pm
checksetup.pl

index 3b90ec6adf4a64b03c6e186d36c57b2b987a6aa2..6b1761959d41b87df39d4a76569ecd195aacb86a 100644 (file)
@@ -68,7 +68,8 @@ sub login {
         trick_taint($ipaddr);
 
         my $dbh = Bugzilla->dbh;
-        $dbh->do("INSERT INTO logincookies (userid, ipaddr) VALUES (?, ?)",
+        $dbh->do("INSERT INTO logincookies (userid, ipaddr, lastused)
+                 VALUES (?, ?, NOW())",
                  undef,
                  $userid, $ipaddr);
         my $logincookie = $dbh->selectrow_array("SELECT LAST_INSERT_ID()");
index 84f2b27a8d4a07710b64c89954589d48956ed6e7..a8ba4f7775940757d9d8971a6cb9dfca0041583b 100644 (file)
@@ -76,7 +76,7 @@ sub authenticate {
     if ($userid) {
         # If we logged in successfully, then update the lastused time on the
         # login cookie
-        $dbh->do("UPDATE logincookies SET lastused=NULL WHERE cookie=?",
+        $dbh->do("UPDATE logincookies SET lastused=NOW() WHERE cookie=?",
                  undef,
                  $login_cookie);
 
index 33ad92539bc298b95921a81094cbd912f9ba6f84..0d1ca477a6a2313973723bb3683b57a22e836d3b 100755 (executable)
@@ -1782,7 +1782,7 @@ $table{logincookies} =
    'cookie mediumint not null auto_increment primary key,
     userid mediumint not null,
     ipaddr varchar(40) NOT NULL,
-    lastused timestamp,
+    lastused DATETIME NOT NULL,
 
     index(lastused)';
 
@@ -4465,6 +4465,13 @@ if (! $sth->rows) {
              "VALUES(1,'Unclassified','Unassigned to any classifications')");
 }
 
+# 2004-08-29 - Tomas.Kopal@altap.cz, bug 257303
+# Change logincookies.lastused type from timestamp to datetime
+if (($fielddef = GetFieldDef("logincookies", "lastused")) &&
+    $fielddef->[1] =~ /^timestamp/) {
+    ChangeFieldType ('logincookies', 'lastused', 'DATETIME NOT NULL');
+}
+
 #
 # Final checks...