|
|
@@ -33,15 +33,24 @@ class DiskSizeValidator extends BaseValidator
|
|
|
}
|
|
|
$diskResource = $resurceManager ->disk();
|
|
|
$diskResource->setTotal($diskResource->getTotal()-$additionalSize);
|
|
|
- $this->maxValue = $diskResource->free();
|
|
|
+ if ($this->isWhmcsConfigOption(ConfigurableOption::STORAGE)) {
|
|
|
+ $this->maxValue = $this->getWhmcsConfigOption(ConfigurableOption::STORAGE) - $diskResource->getUsed();
|
|
|
+ } else {
|
|
|
+ $this->maxValue = $diskResource->free();
|
|
|
+ }
|
|
|
+ if ($this->maxValue > $diskResource->getMax()) {
|
|
|
+ $this->addValidationError('PleaseProvideANumericValueBetween', false, ['minValue' => $this->minValue, 'maxValue' => $diskResource->getMax()]);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
$this->minValue = $diskResource->getMin();
|
|
|
|
|
|
logModuleCall(
|
|
|
'proxmoxCloud',
|
|
|
__FUNCTION__,
|
|
|
- $resurceManager->disk()->free(),
|
|
|
+ $resurceManager->disk()->getFree(),
|
|
|
'Debug',
|
|
|
- $this->getWhmcsConfigOption(ConfigurableOption::STORAGE)
|
|
|
+ $this->maxValue
|
|
|
);
|
|
|
|
|
|
if(preg_match("/\./", $data)){
|