]> git.mxchange.org Git - mailer.git/commitdiff
updateLastActivity() fails in modules like mailid.php
authorRoland Häder <roland@mxchange.org>
Fri, 2 Dec 2011 15:57:53 +0000 (15:57 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 2 Dec 2011 15:57:53 +0000 (15:57 +0000)
inc/mysql-manager.php

index 2b879de773f2d4efce72164d78e206ed41886951..8f807e7ca838a0309ba58628137e26836ee9a462 100644 (file)
@@ -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]