| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace ModulesGarden\ProxmoxAddon\App\Jobs\Vps\Reinstall;
- use ModulesGarden\ProxmoxAddon\App\Jobs\Vps\BaseJob;
- use ModulesGarden\ProxmoxAddon\App\Services\Vps\ProductService;
- class BackupVmJob extends BaseJob
- {
- use ProductService;
- protected function initServices()
- {
- }
- public function handle($text = null)
- {
- $this->initParams();
- $this->initServices();
- if ($this->isDone())
- {
- return true;
- }
- elseif ($this->isTaskRunning())
- {
- $this->sleep(20);
- return false;
- }
- $storage = $this->configuration()->getBackupStorage() ? $this->configuration()->getBackupStorage() : 'local';
- $routing = $this->configuration()->isBackupRouting() == "Yes" ? "1" : "0";
- //backup
- $taskId = $this->vm()->backup($storage, $routing);
- //save task id
- $this->putModelDataAndSave(["taskId" => $taskId, "node" => $this->vm()->getNode()]);
- $this->sleep(20);
- return false;
- }
- }
|