Periodically prune the SFS database
authorAlexander Ebert <ebert@woltlab.com>
Fri, 8 Mar 2019 11:59:56 +0000 (12:59 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 8 Mar 2019 11:59:56 +0000 (12:59 +0100)
wcfsetup/install/files/lib/system/cronjob/DailyCleanUpCronjob.class.php

index e3dafc8407fd0f09b2ddcd46ac64fff05da76c74..00c4061c44d09f81d7038fdcec2bef591968b18a 100644 (file)
@@ -186,5 +186,23 @@ class DailyCleanUpCronjob extends AbstractCronjob {
                                }
                        }
                }
+               
+               if (BLACKLIST_SFS_ENABLE) {
+                       $timeLimit = TIME_NOW - 31 * 86400;
+                       
+                       $sql = "DELETE FROM     wcf".WCF_N."_blacklist_entry
+                               WHERE           lastSeen < ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute([
+                               gmdate('Y-m-d H:i:s', $timeLimit)
+                       ]);
+                       
+                       $sql = "DELETE FROM     wcf".WCF_N."_blacklist_status
+                               WHERE           date < ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute([
+                               gmdate('Y-m-d', $timeLimit)
+                       ]);
+               }
        }
 }