Skip to content
Snippets Groups Projects
Commit 190e254d authored by Masato Takada's avatar Masato Takada Committed by Yas Naoi
Browse files

Issue #3171598 by MasatoTakada, Pooja Ganjage, yas, Masami: Change a variable...

Issue #3171598 by MasatoTakada, Pooja Ganjage, yas, Masami: Change a variable name from $month to $day in deleteResourceStorageEntity function
parent 67a46cc8
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ k8s_js_refresh_interval: 10
k8s_update_resources_queue_cron_time: 5
k8s_update_resource_storage_queue_cron_time: 3600
k8s_update_cost_storage_queue_cron_time: 60
k8s_keep_resource_storage_time_range: 2
k8s_keep_resource_storage_time_range: 60
k8s_yaml_file_extensions: 'yaml yml'
k8s_view_items_per_page: 50
k8s_view_expose_items_per_page: true
......
......@@ -2171,6 +2171,16 @@ function k8s_update_8293() {
drupal_flush_all_caches();
}
/**
* Revise configuration k8s_keep_resource_storage_time_range.
*/
function k8s_update_8294() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('k8s.settings');
$config->set('k8s_keep_resource_storage_time_range', 60);
$config->save();
}
/**
* Implements hook_update_dependencies().
*/
......
......@@ -188,11 +188,11 @@ class K8sAdminSettings extends ConfigFormBase {
$form['cron']['k8s_keep_resource_storage_time_period'] = [
'#type' => 'number',
'#title' => 'The time range to keep resources data',
'#description' => $this->t('The time period to keep resources data of all namespaces.'),
'#default_value' => $config->get('k8s_keep_resource_storage_time_period'),
'#description' => $this->t('The time range to keep resources data of all namespaces.'),
'#default_value' => $config->get('k8s_keep_resource_storage_time_range'),
'#min' => 1,
'#max' => 12,
'#field_suffix' => 'month',
'#max' => 365,
'#field_suffix' => 'days',
];
$form['launch_templates'] = [
......
......@@ -187,9 +187,9 @@ class K8sCloudCostStoragePlugin extends CloudCostStorageBase {
*/
public function deleteResourceStorageEntity() {
$config = \Drupal::config('k8s.settings');
$month = $config->get('k8s_keep_resource_storage_time_range');
$day = $config->get('k8s_keep_resource_storage_time_range');
$from_time = 0;
$to_time = time() - (60 * 60 * 24 * $month);
$to_time = time() - (60 * 60 * 24 * $day);
$this->deleteTimeBased('cloud_resource_storage', $from_time, $to_time);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment