diff --git a/application/controllers/Update.php b/application/controllers/Update.php index 855e713fd..0c2808586 100644 --- a/application/controllers/Update.php +++ b/application/controllers/Update.php @@ -272,6 +272,8 @@ class Update extends CI_Controller { $this->db->query($sql); $this->db->trans_complete(); + $this->_invalidate_dxcc_cache(); + $this->update_status(__("DONE")); echo 'success'; @@ -292,6 +294,26 @@ class Update extends CI_Controller { } + private function _invalidate_dxcc_cache() { + $this->load->is_loaded('cache') ?: $this->load->driver('cache', [ + 'adapter' => $this->config->item('cache_adapter') ?? 'file', + 'backup' => $this->config->item('cache_backup') ?? 'file', + 'key_prefix' => $this->config->item('cache_key_prefix') ?? '' + ]); + + $possible_cachekeys = [ + 'dxcc_exceptions', + 'dxcc_prefixes', + ]; + + foreach ($possible_cachekeys as $cache_key) { + if ($this->cache->get($cache_key) !== false) { + $this->cache->delete($cache_key); + log_message('info', "Deleted cache for key: " . $cache_key); + } + } + } + public function update_status($done=""){ if(!$this->load->is_loaded('Paths')) {