.htaccess
1 year ago
AbortQueueItem.php
1 year ago
AddToQueue.php
3 months ago
ClearAlerts.php
1 year ago
ClearCompletedQueueItems.php
1 year ago
CreateSupportUser.php
1 year ago
DeleteBackupJob.php
1 year ago
DeleteDestination.php
1 year ago
DeleteDownload.php
1 year ago
DeleteSchedule.php
1 year ago
DeleteSnapshot.php
1 year ago
DestinationSetExportConfig.php
1 year ago
DuplicateBackupJob.php
1 year ago
EditBackupNotes.php
1 year ago
EnableBackupJob.php
1 year ago
EnableDestination.php
1 year ago
ExecuteCron.php
1 year ago
FileManager.php
10 months ago
GetBackup.php
1 year ago
GetBackupJob.php
1 year ago
GetDashboard.php
1 year ago
GetDatabaseTables.php
1 year ago
GetDestination.php
1 year ago
GetLog.php
1 year ago
GetQRCode.php
1 year ago
GetQueueItem.php
1 year ago
GetSchedule.php
1 year ago
GetSettingsAutomation.php
1 year ago
GetSettingsGeneral.php
1 year ago
GetSettingsIntegrations.php
1 year ago
GetSettingsLogging.php
1 year ago
GetSettingsMaintenance.php
1 year ago
GetSettingsNotifications.php
1 year ago
GetSettingsPerformance.php
1 year ago
GetSettingsRestore.php
1 year ago
GetSettingsSecurity.php
1 year ago
GetSettingsUpdates.php
1 year ago
GetSystemInfo.php
11 months ago
ListAlerts.php
1 year ago
ListBackupJobs.php
1 year ago
ListBackups.php
1 year ago
ListDatabaseTables.php
1 year ago
ListDestinations.php
1 year ago
ListDownloads.php
1 year ago
ListQueueItems.php
4 months ago
ListSchedules.php
1 year ago
LockSnapshot.php
1 year ago
ManageBackupJob.php
1 year ago
ManageDestination.php
1 year ago
ManageSchedule.php
3 months ago
ManageSettingsAutomation.php
10 months ago
ManageSettingsGeneral.php
4 months ago
ManageSettingsIntegrations.php
1 year ago
ManageSettingsLogging.php
1 year ago
ManageSettingsMaintenance.php
1 year ago
ManageSettingsNotifications.php
1 year ago
ManageSettingsPerformance.php
1 year ago
ManageSettingsRestore.php
1 year ago
ManageSettingsSecurity.php
1 week ago
ManageSettingsUpdates.php
1 year ago
ManageShowcase.php
1 year ago
PanelPreload.php
1 year ago
SendTestEmail.php
1 year ago
StartOverQueueItem.php
1 year ago
ValidateDestination.php
1 year ago
ValidateMFA.php
1 year ago
index.html
1 year ago
web.config
1 year ago
ManageSettingsMaintenance.php
71 lines
| 1 | <?php |
| 2 | |
| 3 | namespace JetBackup\Ajax\Calls; |
| 4 | |
| 5 | use JetBackup\Ajax\aAjax; |
| 6 | use JetBackup\Exception\AjaxException; |
| 7 | use JetBackup\Exception\FieldsValidationException; |
| 8 | use JetBackup\Exception\JBException; |
| 9 | use JetBackup\Factory; |
| 10 | use JetBackup\Settings\Maintenance; |
| 11 | use JetBackup\UserInput\UserInput; |
| 12 | use SleekDB\Exceptions\InvalidArgumentException; |
| 13 | use SleekDB\Exceptions\IOException; |
| 14 | |
| 15 | class ManageSettingsMaintenance extends aAjax { |
| 16 | |
| 17 | /** |
| 18 | * @return int |
| 19 | * @throws AjaxException |
| 20 | */ |
| 21 | private function _getQueueItemsTTL(): int { return $this->getUserInput(Maintenance::MAINTENANCE_QUEUE_HOURS_TTL, 24, UserInput::UINT); } |
| 22 | |
| 23 | /** |
| 24 | * @return int |
| 25 | * @throws AjaxException |
| 26 | */ |
| 27 | private function _getDownloadItemsTTL(): int { return $this->getUserInput(Maintenance::MAINTENANCE_DOWNLOAD_ITEMS_TTL, 72, UserInput::UINT); } |
| 28 | |
| 29 | /** |
| 30 | * @return int |
| 31 | * @throws AjaxException |
| 32 | */ |
| 33 | private function _getDownloadLimit(): int { return $this->getUserInput(Maintenance::MAINTENANCE_DOWNLOAD_LIMIT, 5, UserInput::UINT); } |
| 34 | |
| 35 | /** |
| 36 | * @return int |
| 37 | * @throws AjaxException |
| 38 | */ |
| 39 | private function _getAlertsTTL(): int { return $this->getUserInput(Maintenance::MAINTENANCE_QUEUE_ALERTS_TTL, 72, UserInput::UINT); } |
| 40 | |
| 41 | /** |
| 42 | * @return int |
| 43 | * @throws AjaxException |
| 44 | */ |
| 45 | private function _getConfigExportRotate(): int { return $this->getUserInput(Maintenance::CONFIG_EXPORT_ROTATE, 2, UserInput::UINT); } |
| 46 | |
| 47 | /** |
| 48 | * @return void |
| 49 | * @throws AjaxException |
| 50 | * @throws FieldsValidationException |
| 51 | * @throws InvalidArgumentException |
| 52 | * @throws JBException |
| 53 | * @throws IOException |
| 54 | */ |
| 55 | public function execute(): void { |
| 56 | |
| 57 | $settings = Factory::getSettingsMaintenance(); |
| 58 | |
| 59 | if($this->isset(Maintenance::MAINTENANCE_QUEUE_HOURS_TTL)) $settings->setQueueItemsTTL($this->_getQueueItemsTTL()); |
| 60 | if($this->isset(Maintenance::MAINTENANCE_DOWNLOAD_ITEMS_TTL)) $settings->setDownloadItemsTTL($this->_getDownloadItemsTTL()); |
| 61 | if($this->isset(Maintenance::MAINTENANCE_DOWNLOAD_LIMIT)) $settings->setDownloadLimit($this->_getDownloadLimit()); |
| 62 | if($this->isset(Maintenance::MAINTENANCE_QUEUE_ALERTS_TTL)) $settings->setAlertsTTL($this->_getAlertsTTL()); |
| 63 | if($this->isset(Maintenance::CONFIG_EXPORT_ROTATE)) $settings->setConfigExportRotate($this->_getConfigExportRotate()); |
| 64 | |
| 65 | $settings->validateFields(); |
| 66 | $settings->save(); |
| 67 | |
| 68 | $this->setResponseMessage('Saved Successfully'); |
| 69 | $this->setResponseData($this->isCLI() ? $settings->getDisplayCLI() : $settings->getDisplay()); |
| 70 | } |
| 71 | } |