From 75b4e9797f06b2ae0b0b92afc8ad658e1be59a1f Mon Sep 17 00:00:00 2001 From: quix0r Date: Fri, 2 Dec 2011 15:57:53 +0000 Subject: [PATCH] updateLastActivity() fails in modules like mailid.php --- inc/mysql-manager.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/inc/mysql-manager.php b/inc/mysql-manager.php index 2b879de773..8f807e7ca8 100644 --- a/inc/mysql-manager.php +++ b/inc/mysql-manager.php @@ -1738,8 +1738,10 @@ function createNewTask ($subject, $notes, $taskType, $userid = NULL, $adminId = // Updates last module / online time // @TODO Fix inconsistency between last_module and getWhat() function updateLastActivity($userid) { - // Run the update query - SQL_QUERY_ESC("UPDATE + // Is 'what' set? + if (isWhatSet()) { + // Run the update query + SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `last_module`='%s', @@ -1753,6 +1755,22 @@ LIMIT 1", detectRemoteAddr(), bigintval($userid) ), __FUNCTION__, __LINE__); + } else { + // No what set, needs to be ignored (last_module is last_what) + // @TODO Rename last_module to last_what to make it more clear + SQL_QUERY_ESC("UPDATE + `{?_MYSQL_PREFIX?}_user_data` +SET + `last_online`=UNIX_TIMESTAMP(), + `REMOTE_ADDR`='%s' +WHERE + `userid`=%s +LIMIT 1", + array( + detectRemoteAddr(), + bigintval($userid) + ), __FUNCTION__, __LINE__); + } } // [EOF] -- 2.39.2