PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 3.1.18.8
JetBackup – Backup, Restore & Migrate v3.1.18.8
3.1.22.4 3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / src / JetBackup / Ajax / Calls / DeleteSchedule.php
backup / src / JetBackup / Ajax / Calls Last commit date
.htaccess 5 months ago AbortQueueItem.php 5 months ago AddToQueue.php 5 months ago ClearAlerts.php 5 months ago ClearCompletedQueueItems.php 5 months ago CreateSupportUser.php 5 months ago DeleteBackupJob.php 5 months ago DeleteDestination.php 5 months ago DeleteDownload.php 5 months ago DeleteSchedule.php 5 months ago DeleteSnapshot.php 5 months ago DestinationSetExportConfig.php 5 months ago DuplicateBackupJob.php 5 months ago EditBackupNotes.php 5 months ago EnableBackupJob.php 5 months ago EnableDestination.php 5 months ago ExecuteCron.php 5 months ago FileManager.php 5 months ago GetBackup.php 5 months ago GetBackupJob.php 5 months ago GetDashboard.php 5 months ago GetDatabaseTables.php 5 months ago GetDestination.php 5 months ago GetLog.php 5 months ago GetQRCode.php 5 months ago GetQueueItem.php 5 months ago GetSchedule.php 5 months ago GetSettingsAutomation.php 5 months ago GetSettingsGeneral.php 5 months ago GetSettingsIntegrations.php 5 months ago GetSettingsLogging.php 5 months ago GetSettingsMaintenance.php 5 months ago GetSettingsNotifications.php 5 months ago GetSettingsPerformance.php 5 months ago GetSettingsRestore.php 5 months ago GetSettingsSecurity.php 5 months ago GetSettingsUpdates.php 5 months ago GetSystemInfo.php 5 months ago ListAlerts.php 5 months ago ListBackupJobs.php 5 months ago ListBackups.php 5 months ago ListDatabaseTables.php 5 months ago ListDestinations.php 5 months ago ListDownloads.php 5 months ago ListQueueItems.php 5 months ago ListSchedules.php 5 months ago LockSnapshot.php 5 months ago ManageBackupJob.php 5 months ago ManageDestination.php 5 months ago ManageSchedule.php 5 months ago ManageSettingsAutomation.php 5 months ago ManageSettingsGeneral.php 5 months ago ManageSettingsIntegrations.php 5 months ago ManageSettingsLogging.php 5 months ago ManageSettingsMaintenance.php 5 months ago ManageSettingsNotifications.php 5 months ago ManageSettingsPerformance.php 5 months ago ManageSettingsRestore.php 5 months ago ManageSettingsSecurity.php 5 months ago ManageSettingsUpdates.php 5 months ago ManageShowcase.php 5 months ago PanelPreload.php 5 months ago SendTestEmail.php 5 months ago StartOverQueueItem.php 5 months ago ValidateDestination.php 5 months ago ValidateMFA.php 5 months ago index.html 5 months ago web.config 5 months ago
DeleteSchedule.php
56 lines
1 <?php
2
3 namespace JetBackup\Ajax\Calls;
4
5 if (!defined( '__JETBACKUP__')) die('Direct access is not allowed');
6
7 use JetBackup\Ajax\aAjax;
8 use JetBackup\Exception\AjaxException;
9 use JetBackup\Exception\DBException;
10 use JetBackup\JetBackup;
11 use JetBackup\Schedule\Schedule;
12 use JetBackup\UserInput\UserInput;
13 use SleekDB\Exceptions\InvalidArgumentException;
14 use SleekDB\Exceptions\IOException;
15
16 class DeleteSchedule extends aAjax {
17
18 /**
19 * @return int
20 * @throws AjaxException
21 */
22 public function getId():int { return $this->getUserInput(JetBackup::ID_FIELD, 0, UserInput::UINT); }
23
24 /**
25 * @param $schedule
26 *
27 * @return int
28 */
29 private function _getScheduleCount($schedule):int {
30
31 return sizeof($schedule::query()
32 ->select([JetBackup::ID_FIELD])
33 ->where([ Schedule::TYPE, "=", $schedule->getType() ])
34 ->where([ Schedule::HIDDEN, "=", false ])
35 ->getQuery()
36 ->fetch());
37 }
38
39 /**
40 * @return void
41 * @throws AjaxException
42 * @throws DBException
43 * @throws IOException
44 * @throws InvalidArgumentException
45 */
46 public function execute(): void {
47 if(!$this->getId()) throw new AjaxException("No schedule id provided");
48 $schedule = new Schedule($this->getId());
49 if(!$schedule->getId() || $schedule->isHidden()) throw new AjaxException("Invalid schedule id provided");
50 if($schedule->getJobsCount() > 0) throw new AjaxException("Cannot delete a schedule with jobs assigned");
51 if($schedule->isDefault()) throw new AjaxException("Cannot delete a system default schedule");
52
53 $schedule->delete();
54 $this->setResponseMessage("Schedule Deleted successfully! Reloading...");
55 }
56 }