[Rspamd] Properly cache Rspamd settings map, save a lot of resources

master
andryyy 2021-09-02 14:09:50 +02:00
parent bb2351ccf8
commit 43121b9287
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 2 additions and 4 deletions

View File

@ -26,9 +26,8 @@ catch (PDOException $e) {
} }
// Check if db changed and return header // Check if db changed and return header
/* $stmt = $pdo->prepare("SELECT GREATEST(COALESCE(MAX(UNIX_TIMESTAMP(UPDATE_TIME)), 1), COALESCE(MAX(UNIX_TIMESTAMP(CREATE_TIME)), 1)) AS `db_update_time` FROM `information_schema`.`tables`
$stmt = $pdo->prepare("SELECT MAX(UNIX_TIMESTAMP(UPDATE_TIME)) AS `db_update_time` FROM information_schema.tables WHERE (`TABLE_NAME` = 'filterconf' OR `TABLE_NAME` = 'settingsmap' OR `TABLE_NAME` = 'sogo_quick_contact' AND `TABLE_NAME` = 'alias')
WHERE (`TABLE_NAME` = 'filterconf' OR `TABLE_NAME` = 'settingsmap')
AND TABLE_SCHEMA = :dbname;"); AND TABLE_SCHEMA = :dbname;");
$stmt->execute(array( $stmt->execute(array(
':dbname' => $database_name ':dbname' => $database_name
@ -43,7 +42,6 @@ if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && (strtotime($_SERVER['HTTP_IF_MO
} else { } else {
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $db_update_time).' GMT', true, 200); header('Last-Modified: '.gmdate('D, d M Y H:i:s', $db_update_time).' GMT', true, 200);
} }
*/
function parse_email($email) { function parse_email($email) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return false; if (!filter_var($email, FILTER_VALIDATE_EMAIL)) return false;