Browse Source

Use NOW in token expiry schedule

spaghetti 4 years ago
parent
commit
0654fc16f1
1 changed files with 3 additions and 4 deletions
  1. 3
    4
      sections/schedule/every/expire_tokens.php

+ 3
- 4
sections/schedule/every/expire_tokens.php View File

@@ -1,12 +1,11 @@
1 1
 <?
2 2
 //------------- Expire old FL Tokens and clear cache where needed ------//
3 3
 
4
-$sqltime = sqltime();
5 4
 $DB->query("
6 5
   SELECT DISTINCT UserID
7 6
   FROM users_freeleeches
8 7
   WHERE Expired = FALSE
9
-    AND Time < '$sqltime' - INTERVAL 4 DAY");
8
+    AND Time < (NOW() - INTERVAL 4 DAY)");
10 9
 if ($DB->has_results()) {
11 10
   while (list($UserID) = $DB->next_record()) {
12 11
     $Cache->delete_value('users_tokens_'.$UserID[0]);
@@ -17,14 +16,14 @@ if ($DB->has_results()) {
17 16
     FROM users_freeleeches AS uf
18 17
       JOIN torrents AS t ON uf.TorrentID = t.ID
19 18
     WHERE uf.Expired = FALSE
20
-      AND uf.Time < '$sqltime' - INTERVAL 4 DAY");
19
+      AND uf.Time < (NOW() - INTERVAL 4 DAY)");
21 20
   while (list($UserID, $InfoHash) = $DB->next_record(MYSQLI_NUM, false)) {
22 21
     Tracker::update_tracker('remove_token', array('info_hash' => rawurlencode($InfoHash), 'userid' => $UserID));
23 22
   }
24 23
   $DB->query("
25 24
     UPDATE users_freeleeches
26 25
     SET Expired = TRUE
27
-    WHERE Time < '$sqltime' - INTERVAL 4 DAY
26
+    WHERE Time < (NOW() - INTERVAL 4 DAY)
28 27
       AND Expired = FALSE");
29 28
 }
30 29
 ?>

Loading…
Cancel
Save