/// <summary> /// Performs actual backup. /// </summary> public override void DoWork() { string backupFileName; int storePackageId; string storePackageFolder; string storeServerFolder; bool deleteTempBackup; try { backupFileName = (string)TaskManager.TaskParameters["BACKUP_FILE_NAME"]; storePackageId = Convert.ToInt32(TaskManager.TaskParameters["STORE_PACKAGE_ID"]); storePackageFolder = (string)TaskManager.TaskParameters["STORE_PACKAGE_FOLDER"]; storeServerFolder = (string)TaskManager.TaskParameters["STORE_SERVER_FOLDER"]; deleteTempBackup = Convert.ToBoolean(TaskManager.TaskParameters["DELETE_TEMP_BACKUP"]); } catch (Exception ex) { TaskManager.WriteError(ex, "Some parameters are absent or have incorrect value."); return; } try { PackageInfo package = PackageController.GetPackage(TaskManager.PackageId); // We do not take into account service id as long as scheduled tasks run against packages. BackupController.Backup(false, "BackupTask", package.UserId, package.PackageId, 0, 0, backupFileName, storePackageId, storePackageFolder, storeServerFolder, deleteTempBackup); } catch (Exception ex) { TaskManager.WriteError(ex, "Failed to do backup."); } }
public int Backup(bool async, string taskId, int userId, int packageId, int serviceId, int serverId, string backupFileName, int storePackageId, string storePackageFolder, string storeServerFolder, bool deleteTempBackup) { return(BackupController.Backup(async, taskId, userId, packageId, serviceId, serverId, backupFileName, storePackageId, storePackageFolder, storeServerFolder, deleteTempBackup)); }