make sure the cache clearing does not run more often then needed

This commit is contained in:
HB9HIL
2024-11-11 20:33:17 +01:00
parent 4fc175c0fb
commit b2826377fc
3 changed files with 9 additions and 13 deletions

View File

@@ -256,12 +256,6 @@ class adif extends CI_Controller {
$custom_errors=__("Station Profile not valid for User");
}
// Lets clean up static maps cache for this station
if (!$this->load->is_loaded('staticmap_model')) {
$this->load->model('staticmap_model');
}
$this->staticmap_model->remove_static_map_image($this->input->post('station_profile', TRUE));
log_message("Error","ADIF End");
$data['adif_errors'] = $custom_errors;
$data['skip_dupes'] = $this->input->post('skipDuplicate');

View File

@@ -60,7 +60,7 @@ class Station extends CI_Controller
if ($this->stations->edit()) {
$data['notice'] = __("Station Location") . $this->security->xss_clean($this->input->post('station_profile_name', true)) . " Updated";
}
// Also clean up static map images first
// Also clean up static map images
if (!$this->load->is_loaded('staticmap_model')) {
$this->load->model('staticmap_model');
}

View File

@@ -3659,6 +3659,14 @@ class Logbook_model extends CI_Model {
}
}
}
// if there are any static map images for this station, remove them so they can be regenerated
if (!$this->load->is_loaded('staticmap_model')) {
$this->load->model('staticmap_model');
}
$this->staticmap_model->remove_static_map_image($station_id);
log_message('error', 'Cache-Clearing called in ' . $this->router->class.'_'.$this->router->method);
$records = '';
gc_collect_cycles();
if (count($a_qsos) > 0) {
@@ -4373,12 +4381,6 @@ class Logbook_model extends CI_Model {
} else {
$this->add_qso($data, $skipexport);
}
// if there are any static map images for this station, remove them so they can be regenerated
if (!$this->load->is_loaded('staticmap_model')) {
$this->load->model('staticmap_model');
}
$this->staticmap_model->remove_static_map_image($station_id);
} else {
$my_error .= "Date/Time: " . ($time_on ?? 'N/A') . " Callsign: " . ($record['call'] ?? 'N/A') . " Band: " . ($band ?? 'N/A') . " ".__("Duplicate for")." ". ($station_profile_call ?? 'N/A') . "<br>";