Commit c609afdd authored by jocuri%softhome.net's avatar jocuri%softhome.net

Patch for bug 257303: convert lastused field in logincookies from timestamp to…

Patch for bug 257303: convert lastused field in logincookies from timestamp to datetime; patch by Tomas Kopal <Tomas.Kopal@altap.cz>; r=vladd, a=justdave.
parent 57c78bf9
...@@ -68,7 +68,8 @@ sub login { ...@@ -68,7 +68,8 @@ sub login {
trick_taint($ipaddr); trick_taint($ipaddr);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
$dbh->do("INSERT INTO logincookies (userid, ipaddr) VALUES (?, ?)", $dbh->do("INSERT INTO logincookies (userid, ipaddr, lastused)
VALUES (?, ?, NOW())",
undef, undef,
$userid, $ipaddr); $userid, $ipaddr);
my $logincookie = $dbh->selectrow_array("SELECT LAST_INSERT_ID()"); my $logincookie = $dbh->selectrow_array("SELECT LAST_INSERT_ID()");
......
...@@ -76,7 +76,7 @@ sub authenticate { ...@@ -76,7 +76,7 @@ sub authenticate {
if ($userid) { if ($userid) {
# If we logged in successfully, then update the lastused time on the # If we logged in successfully, then update the lastused time on the
# login cookie # login cookie
$dbh->do("UPDATE logincookies SET lastused=NULL WHERE cookie=?", $dbh->do("UPDATE logincookies SET lastused=NOW() WHERE cookie=?",
undef, undef,
$login_cookie); $login_cookie);
......
...@@ -1782,7 +1782,7 @@ $table{logincookies} = ...@@ -1782,7 +1782,7 @@ $table{logincookies} =
'cookie mediumint not null auto_increment primary key, 'cookie mediumint not null auto_increment primary key,
userid mediumint not null, userid mediumint not null,
ipaddr varchar(40) NOT NULL, ipaddr varchar(40) NOT NULL,
lastused timestamp, lastused DATETIME NOT NULL,
index(lastused)'; index(lastused)';
...@@ -4465,6 +4465,13 @@ if (! $sth->rows) { ...@@ -4465,6 +4465,13 @@ if (! $sth->rows) {
"VALUES(1,'Unclassified','Unassigned to any classifications')"); "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... # Final checks...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment