|
|
@@ -46,20 +46,17 @@ class SnapshotProvider extends BaseDataProvider implements ClientArea
|
|
|
{
|
|
|
|
|
|
$this->acl()->snapshot();
|
|
|
- $this->resourceGuard()->snapshotLimit();
|
|
|
$vm = \ModulesGarden\ProxmoxAddon\Core\Helper\sl('Vm')->getVm();
|
|
|
|
|
|
- $testRepo = new SnapshotRepository();
|
|
|
- $testRepo->setApi($this->api());
|
|
|
- $testRepo->findByVm($vm);
|
|
|
+ $snapRepo = new SnapshotRepository();
|
|
|
+ $snapRepo->setApi($this->api());
|
|
|
+ $snapRepo->findByVm($vm);
|
|
|
|
|
|
- logModuleCall(
|
|
|
- 'ProxmoxCloudVps',
|
|
|
- __FUNCTION__,
|
|
|
- $this->getWhmcsConfigOption(ConfigurableOption::SNAPSHOTS, $this->configuration()->getSnapshotMaxFiles()),
|
|
|
- 'Debug',
|
|
|
- $testRepo->count()
|
|
|
- );
|
|
|
+ $maxSnap = $this->getWhmcsConfigOption(ConfigurableOption::SNAPSHOTS, $this->configuration()->getSnapshotMaxFiles());
|
|
|
+ if ($maxSnap != "-1" && $snapRepo->count() >= $maxSnap)
|
|
|
+ {
|
|
|
+ throw new \Exception(sl("lang")->tr("The maximum number of snapshots has been exceeded. Please remove the old snapshots."));
|
|
|
+ }
|
|
|
|
|
|
$snapshot = new Snapshot();
|
|
|
$snapshot->setApi($this->api());
|