Delete article from memcache when deleted by nocem.

This commit is contained in:
Retro_Guy 2024-05-09 03:01:42 -07:00
parent 85a035beb5
commit de02cb4f8b
2 changed files with 17 additions and 1 deletions

View File

@ -2613,7 +2613,10 @@ function send_admin_message($admin, $from, $subject, $message)
function delete_message($messageid, $group = null, $overview_dbh = null)
{
global $logfile, $config_dir, $spooldir, $CONFIG, $webserver_group;
global $logfile, $logdir, $config_dir, $spooldir, $CONFIG, $webserver_group;
if (file_exists($config_dir . '/memcache.inc.php')) {
include $config_dir . '/memcache.inc.php';
}
if ($group == null) {
$message = get_data_from_msgid($messageid);
$groups = $message['newsgroup'];
@ -2688,6 +2691,18 @@ function delete_message($messageid, $group = null, $overview_dbh = null)
':newsgroup' => $group,
':msgid' => $messageid
]);
// Delete article from memcache
if ($memcacheD) {
$article_key = 'article.db3-' . $group . $row['number'];
$result = $memcacheD->delete($article_key);
if($enable_memcache_logging) {
if($result) {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Deleted $article_key from memcache", FILE_APPEND);
} else {
file_put_contents($logdir . '/memcache.log', "\n" . format_log_date() . " Failed to delete (or not found) $article_key from memcache", FILE_APPEND);
}
}
}
}
}
if ($close_ovdb) {

View File

@ -1,4 +1,5 @@
<?php
/* memcached and php-memcached must be installed */
$enable_memcache = false;