HEX
Server: LiteSpeed
System: Linux melbournecleaninggroup 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: www-data (33)
PHP: 7.3.33-1+focal
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/wp-content/plugins/backup-guard-platinum/com/core/backup/SGBackupSchedule.php
<?php
require_once(SG_SCHEDULE_PATH.'SGSchedule.php');

class SGBackupSchedule
{
	public static function create($cron, $options, $label)
	{
		$sgdb = SGDatabase::getInstance();
		$params = array();
		$query = '';

		if (!SGBoot::isFeatureAvailable('MULTI_SCHEDULE')) {
			self::remove();
			$query = 'INSERT INTO '.SG_SCHEDULE_TABLE_NAME.' (id, label, status, schedule_options, backup_options) VALUES (%d, %s, %d, %s, %s) ON DUPLICATE KEY UPDATE label=%s, schedule_options=%s, backup_options=%s';

			$params = array(
				SG_SCHEDULER_DEFAULT_ID,
				$label,
				SG_SHCEDULE_STATUS_PENDING,
				json_encode($cron),
				json_encode($options),
				$label,
				json_encode($cron),
				json_encode($options)
			);
		}
		else {
			$query = 'INSERT INTO '.SG_SCHEDULE_TABLE_NAME.' (label, status, schedule_options, backup_options) VALUES (%s, %d, %s, %s)';

			$params = array(
				$label,
				SG_SHCEDULE_STATUS_PENDING,
				json_encode($cron),
				json_encode($options)
			);
		}

		$res = $sgdb->query($query, $params);

		if ($res) {
			$id = $sgdb->lastInsertId();
			SGSchedule::create($cron, $id);
		}
	}

	public static function remove($id = SG_SCHEDULER_DEFAULT_ID)
	{
		$sgdb = SGDatabase::getInstance();
		$sgdb->query('DELETE FROM '.SG_SCHEDULE_TABLE_NAME.' WHERE id=%d', array($id));
		SGSchedule::remove($id);
	}

	public static function getCronExecutionData($cron)
	{
		$cron = json_decode($cron, true);
		return SGSchedule::getCronExecutionData($cron);
	}

	public static function getAllSchedules()
	{
		$sgdb = SGDatabase::getInstance();
		$results = $sgdb->query('SELECT id, label, status, schedule_options, backup_options FROM '.SG_SCHEDULE_TABLE_NAME);
		$schedules = array();
		foreach ($results as $key => $row) {
			$schedules[$key]['id'] = $row['id'];
			$schedules[$key]['label'] = $row['label'];
			$schedules[$key]['status'] = $row['status'];
			$cronExecutionData = self::getCronExecutionData($row['schedule_options']);

			$schedules[$key]['recurrence'] = ucfirst($cronExecutionData['recurrence']);
			$schedules[$key]['executionDate'] = $cronExecutionData['time'];
			$schedules[$key]['backup_options'] = $row['backup_options'];
		}

		return $schedules;
	}
}