BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

remove_dead_sessions.php 647B

1234567891011121314151617181920212223
  1. <?php
  2. $AgoMins = time_minus(60 * 30);
  3. $AgoDays = time_minus(3600 * 24 * 30);
  4. $SessionQuery = $DB->query("
  5. SELECT UserID, SessionID
  6. FROM users_sessions
  7. WHERE (LastUpdate < '$AgoDays' AND KeepLogged = '1')
  8. OR (LastUpdate < '$AgoMins' AND KeepLogged = '0')");
  9. $DB->query("
  10. DELETE FROM users_sessions
  11. WHERE (LastUpdate < '$AgoDays' AND KeepLogged = '1')
  12. OR (LastUpdate < '$AgoMins' AND KeepLogged = '0')");
  13. $DB->set_query_id($SessionQuery);
  14. while (list($UserID, $SessionID) = $DB->next_record()) {
  15. $Cache->begin_transaction("users_sessions_$UserID");
  16. $Cache->delete_row($SessionID);
  17. $Cache->commit_transaction(0);
  18. }