From c70aeb15969f3fc9827f97f4ea34b4a99c41ec0b Mon Sep 17 00:00:00 2001 From: zhaixiaojian Date: Tue, 16 Jul 2024 09:04:06 +0800 Subject: [PATCH] * [story#60132,done,4h,0h] variable naming adjustment. --- module/instance/control.php | 6 +++--- module/instance/model.php | 30 +++++++++++++++--------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/module/instance/control.php b/module/instance/control.php index 1572d9a8d9..31f005e567 100644 --- a/module/instance/control.php +++ b/module/instance/control.php @@ -109,7 +109,7 @@ class instance extends control if($memoryKb * 1024 > $freeMemory) $this->send(array('result' => 'fail', 'message' => $this->lang->instance->errors->notEnoughResource)); /* Request CNE to adjust memory size. */ - $instance->oldVal = $currentResource->max->memory; + $instance->oldValue = $currentResource->max->memory; if(!$this->instance->updateMemorySize($instance, $memoryKb * 1024)) { return $this->send(array('result' => 'fail', 'message' => dao::getError())); @@ -119,7 +119,7 @@ class instance extends control $cpu = $newInstance->cpu; if($currentResource->max->cpu != $cpu) { - $instance->oldVal = $currentResource->max->cpu; + $instance->oldValue = $currentResource->max->cpu; if(!$this->instance->updateCpuSize($instance, $cpu)) { return $this->send(array('result' => 'fail', 'message' => dao::getError())); @@ -130,7 +130,7 @@ class instance extends control if(is_numeric($disk) && $disk != $diskSettings->size && $disk != $diskSettings->requestSize) { if($disk < $diskSettings->size || $disk > $diskSettings->limit) return $this->send(array('result' => 'fail', 'message' => $this->lang->instance->errors->invalidDiskSize)); - $instance->oldVal = $diskSettings->size; + $instance->oldValue = $diskSettings->size; if(!$this->instance->updateVolSize($instance, $disk . 'Gi', $diskSettings->name)) return $this->send(array('result' => 'fail', 'message' => dao::getError())); } diff --git a/module/instance/model.php b/module/instance/model.php index c1c3c39313..5d77932ed8 100644 --- a/module/instance/model.php +++ b/module/instance/model.php @@ -272,14 +272,14 @@ class instanceModel extends model $settings->settings_map->resources = new stdclass; $settings->settings_map->resources->memory = $size; - $oldVal = helper::formatKB($instance->oldVal); - $newVal = helper::formatKB(intval($size)); - unset($instance->oldVal); + $oldValue = helper::formatKB($instance->oldVal); + $newValue = helper::formatKB(intval($size)); + unset($instance->oldValue); $success = $this->cne->updateConfig($instance, $settings); if($success) { - $actionID = $this->action->create('instance', $instance->id, 'adjustMemory', $newVal); - $this->action->logHistory($actionID, [['field' => 'adjustmemory', 'old' => $oldVal, 'new' => $newVal, 'diff' => '']]); + $actionID = $this->action->create('instance', $instance->id, 'adjustMemory', $newValue); + $this->action->logHistory($actionID, [['field' => 'adjustmemory', 'old' => $oldValue, 'new' => $newValue, 'diff' => '']]); return true; } @@ -303,14 +303,14 @@ class instanceModel extends model $settings->settings_map->resources = new stdclass; $settings->settings_map->resources->cpu = $size; - $oldVal = $instance->oldVal; - $newVal = (string)$size; - unset($instance->oldVal); + $oldValue = $instance->oldValue; + $newValue = (string)$size; + unset($instance->oldValue); $success = $this->cne->updateConfig($instance, $settings); if($success) { - $actionID = $this->action->create('instance', $instance->id, 'adjustCPU', $newVal); - $this->action->logHistory($actionID, [['field' => 'adjustcpu', 'old' => $oldVal, 'new' => $newVal, 'diff' => '']]); + $actionID = $this->action->create('instance', $instance->id, 'adjustCPU', $newValue); + $this->action->logHistory($actionID, [['field' => 'adjustcpu', 'old' => $oldValue, 'new' => $newValue, 'diff' => '']]); return true; } @@ -345,14 +345,14 @@ class instanceModel extends model $settings->settings = array(); $settings->settings[] = $setting; - $oldVal = $instance->oldVal; - $newVal = str_replace('Gi', '', $size); - unset($instance->oldVal); + $oldValue = $instance->oldValue; + $newValue = str_replace('Gi', '', $size); + unset($instance->oldValue); $success = $this->cne->updateConfig($instance, $settings); if($success) { - $actionID = $this->action->create('instance', $instance->id, 'adjustVol', $newVal); - $this->action->logHistory($actionID, [['field' => 'adjustvol', 'old' => $oldVal, 'new' => $newVal, 'diff' => '']]); + $actionID = $this->action->create('instance', $instance->id, 'adjustVol', $newValue); + $this->action->logHistory($actionID, [['field' => 'adjustvol', 'old' => $oldValue, 'new' => $newValue, 'diff' => '']]); return true; }