From: Roland Häder Date: Fri, 2 Dec 2011 15:57:53 +0000 (+0000) Subject: updateLastActivity() fails in modules like mailid.php X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=63bab4370ad4c100c74211ad2efdb96698f8dc12;p=mailer.git updateLastActivity() fails in modules like mailid.php --- 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]