namespace wcf\data\email\log\entry;
use wcf\data\AbstractDatabaseObjectAction;
+use wcf\system\WCF;
/**
* Executes email log entry-related actions.
* @inheritDoc
*/
protected $className = EmailLogEntryEditor::class;
+
+ /**
+ * Deletes old log entries.
+ */
+ public function prune()
+ {
+ $sql = "SELECT entryID
+ FROM wcf" . WCF_N . "_email_log_entry
+ WHERE time < ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute([
+ (\TIME_NOW - EmailLogEntry::LIFETIME),
+ ]);
+ $entryIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
+
+ (new self($entryIDs, 'delete'))->executeAction();
+ }
}
namespace wcf\system\cronjob;
use wcf\data\cronjob\Cronjob;
+use wcf\data\email\log\entry\EmailLogEntryAction;
use wcf\data\object\type\ObjectTypeCache;
use wcf\system\flood\FloodControl;
use wcf\system\user\multifactor\EmailMultifactorMethod;
FloodControl::getInstance()->prune();
EmailMultifactorMethod::prune();
+ (new EmailLogEntryAction([], 'prune'))->executeAction();
}
}