function getScheduledBackup() { if (!is_object($this->scheduledBackup)) { $info = $this->getInfo(); $scheduledBackupGetter = new scheduledBackupGetter(); $this->scheduledBackup = $scheduledBackupGetter->getById($info['scheduled_backup_id']); } return $this->scheduledBackup; }
function getScheduledBackup() { if (!is_numeric($this->id)) { throw new Exception('backupJob->getInfo: ' . "Error: The ID for this object is not an integer."); } $info = $this->getInfo(); $scheduledBackupGetter = new scheduledBackupGetter(); $scheduledBackupGetter->setLogStream($this->log); return $scheduledBackupGetter->getById($info['scheduled_backup_id']); }
function getScheduledBackup() { $this->__validate(); $info = $this->getInfo(); $scheduledBackupGetter = new scheduledBackupGetter(); $this->scheduledBackup = $scheduledBackupGetter->getById($info['scheduled_backup_id']); return $this->scheduledBackup; }
function getStagingTmpdir() { global $config; if (!is_numeric($this->id)) { throw new Exception('runningBackup->getStagingTmpdir: ' . "Error: The ID for this object is not an integer."); } $conn = dbConnection::getInstance($this->log); $info = $this->getInfo(); // Collect the info we need to connect to the remote host $backupGetter = new scheduledBackupGetter(); $scheduledBackup = $backupGetter->getById($info['scheduled_backup_id']); $sbInfo = $scheduledBackup->getInfo(); $host = $scheduledBackup->getHost(); $hostInfo = $host->getInfo(); $this->remoteTempDir = new remoteTempDir(); $tempDir = $this->remoteTempDir->init($hostInfo['hostname'], $hostInfo['ssh_port'], $sbInfo['backup_user'], $hostInfo['staging_path'], 'xbm-'); // Put the path into the DB $sql = "UPDATE running_backups SET staging_tmpdir='" . $conn->real_escape_string($tempDir) . "' WHERE running_backup_id=" . $this->id; if (!$conn->query($sql)) { throw new Exception('runningBackup->getStagingTmpdir: ' . "Error: Query: {$sql} \nFailed with MySQL Error: {$conn->error}"); } return $tempDir; }
function getScheduledBackups() { // Validate this... if (!is_numeric($this->id)) { throw new Exception('backupVolume->getScheduledBackups: ' . "Error: The ID for this object is not an integer."); } global $config; $conn = dbConnection::getInstance($this->log); $sql = "SELECT scheduled_backup_id FROM scheduled_backups WHERE backup_volume_id=" . $this->id; if (!($res = $conn->query($sql))) { throw new DBException('backupVolume->getScheduledBackups: ' . "Error: Query: {$sql} \nFailed with MySQL Error: {$conn->error}"); } $backupGetter = new scheduledBackupGetter(); $backupGetter->setLogStream($this->log); $backups = array(); while ($row = $res->fetch_array()) { $backups[] = $backupGetter->getById($row['scheduled_backup_id']); } return $backups; }