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.

git-svn-id: svn://10.0.0.236/trunk@161950 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jocuri%softhome.net 2004-09-08 23:29:08 +00:00
parent e16d50ce6e
commit a45d30a5bb
3 changed files with 11 additions and 3 deletions

View 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()");

View 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);

View File

@ -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...