Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
0284798a
Commit
0284798a
authored
Jan 24, 2012
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 240437: Add a "last seen date" column to the profiles table
r=LpSolit, a=LpSolit
parent
96624a11
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
11 deletions
+59
-11
Bugzilla.pm
Bugzilla.pm
+6
-0
Schema.pm
Bugzilla/DB/Schema.pm
+1
-0
DB.pm
Bugzilla/Install/DB.pm
+3
-0
User.pm
Bugzilla/User.pm
+33
-10
editusers.cgi
editusers.cgi
+2
-1
edit.html.tmpl
template/en/default/admin/users/edit.html.tmpl
+11
-0
list.html.tmpl
template/en/default/admin/users/list.html.tmpl
+3
-0
No files found.
Bugzilla.pm
View file @
0284798a
...
...
@@ -371,6 +371,12 @@ sub login {
$class
->
set_user
(
$authenticated_user
);
}
if
(
$class
->
sudoer
)
{
$class
->
sudoer
->
update_last_seen_date
();
}
else
{
$class
->
user
->
update_last_seen_date
();
}
return
$class
->
user
;
}
...
...
Bugzilla/DB/Schema.pm
View file @
0284798a
...
...
@@ -869,6 +869,7 @@ use constant ABSTRACT_SCHEMA => {
extern_id
=>
{
TYPE
=>
'varchar(64)'
},
is_enabled
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'TRUE'
},
last_seen_date
=>
{
TYPE
=>
'DATETIME'
},
],
INDEXES
=>
[
profiles_login_name_idx
=>
{
FIELDS
=>
[
'login_name'
],
...
...
Bugzilla/Install/DB.pm
View file @
0284798a
...
...
@@ -647,6 +647,9 @@ sub update_table_definitions {
# 2011-06-15 dkl@mozilla.com - Bug 658929
_migrate_disabledtext_boolean
();
# 2011-11-01 glob@mozilla.com - Bug 240437
$dbh
->
bz_add_column
(
'profiles'
,
'last_seen_date'
,
{
TYPE
=>
'DATETIME'
});
# 2011-10-11 miketosh - Bug 690173
_on_delete_set_null_for_audit_log_userid
();
...
...
Bugzilla/User.pm
View file @
0284798a
...
...
@@ -65,16 +65,21 @@ use constant DB_TABLE => 'profiles';
# that you passed in for "name" to new(). That's because historically
# Bugzilla::User used "name" for the realname field. This should be
# fixed one day.
use
constant
DB_COLUMNS
=>
(
'profiles.userid'
,
'profiles.login_name'
,
'profiles.realname'
,
'profiles.mybugslink AS showmybugslink'
,
'profiles.disabledtext'
,
'profiles.disable_mail'
,
'profiles.extern_id'
,
'profiles.is_enabled'
,
);
sub
DB_COLUMNS
{
my
$dbh
=
Bugzilla
->
dbh
;
return
(
'profiles.userid'
,
'profiles.login_name'
,
'profiles.realname'
,
'profiles.mybugslink AS showmybugslink'
,
'profiles.disabledtext'
,
'profiles.disable_mail'
,
'profiles.extern_id'
,
'profiles.is_enabled'
,
$dbh
->
sql_date_format
(
'last_seen_date'
,
'%Y-%m-%d'
)
.
' AS last_seen_date'
,
),
}
use
constant
NAME_FIELD
=>
'login_name'
;
use
constant
ID_FIELD
=>
'userid'
;
use
constant
LIST_ORDER
=>
NAME_FIELD
;
...
...
@@ -258,6 +263,23 @@ sub set_disabledtext {
$_
[
0
]
->
set
(
'is_enabled'
,
$_
[
1
]
?
0
:
1
);
}
sub
update_last_seen_date
{
my
$self
=
shift
;
return
unless
$self
->
id
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$date
=
$dbh
->
selectrow_array
(
'SELECT '
.
$dbh
->
sql_date_format
(
'NOW()'
,
'%Y-%m-%d'
));
if
(
!
$self
->
last_seen_date
or
$date
ne
$self
->
last_seen_date
)
{
$self
->
{
last_seen_date
}
=
$date
;
# We don't use the normal update() routine here as we only
# want to update the last_seen_date column, not any other
# pending changes
$dbh
->
do
(
"UPDATE profiles SET last_seen_date = ? WHERE userid = ?"
,
undef
,
$date
,
$self
->
id
);
}
}
################################################################################
# Methods
################################################################################
...
...
@@ -272,6 +294,7 @@ sub is_enabled { $_[0]->{'is_enabled'} ? 1 : 0; }
sub
showmybugslink
{
$_
[
0
]
->
{
showmybugslink
};
}
sub
email_disabled
{
$_
[
0
]
->
{
disable_mail
};
}
sub
email_enabled
{
!
(
$_
[
0
]
->
{
disable_mail
});
}
sub
last_seen_date
{
$_
[
0
]
->
{
last_seen_date
};
}
sub
cryptpassword
{
my
$self
=
shift
;
# We don't store it because we never want it in the object (we
...
...
editusers.cgi
View file @
0284798a
...
...
@@ -64,7 +64,8 @@ if ($action eq 'search') {
my
$matchtype
=
$cgi
->
param
(
'matchtype'
);
my
$grouprestrict
=
$cgi
->
param
(
'grouprestrict'
)
||
'0'
;
my
$enabled_only
=
$cgi
->
param
(
'enabled_only'
)
||
'0'
;
my
$query
=
'SELECT DISTINCT userid, login_name, realname, is_enabled '
.
my
$query
=
'SELECT DISTINCT userid, login_name, realname, is_enabled, '
.
$dbh
->
sql_date_format
(
'last_seen_date'
,
'%Y-%m-%d'
)
.
' AS last_seen_date '
.
'FROM profiles'
;
my
@bindValues
;
my
$nextCondition
;
...
...
template/en/default/admin/users/edit.html.tmpl
View file @
0284798a
...
...
@@ -101,6 +101,17 @@
[% END %]
</td>
</tr>
<tr>
<th>Last Login:</th>
<td>
[% IF otheruser.last_seen_date %]
[% otheruser.last_seen_date FILTER html %]
[% ELSE %]
<em>never</em>
[% END %]
</td>
</tr>
</table>
<p>
...
...
template/en/default/admin/users/list.html.tmpl
View file @
0284798a
...
...
@@ -35,6 +35,9 @@
{name => 'realname'
heading => 'Real name'
}
{name => 'last_seen_date'
heading => 'Last Login'
}
{heading => 'Account History'
content => 'View'
contentlink => 'editusers.cgi?action=activity' _
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment