function validateParams($sbParams) { // // VALIDATE POSSIBLE PARAMETERS FOR THIS BACKUP // // Pick a rotation method (required) // rotate_method - DAY_OF_WEEK or AFTER_SNAPSHOT_COUNT // Validate Rotation Method scheduledBackup::validateRotateMethod($sbParams['rotate_method']); switch ($sbParams['rotate_method']) { // // DAY_OF_WEEK options // case 'DAY_OF_WEEK': // rotate_day_of_week - Create a new snapshot group on this day of the week. // The above uses the same day numbering as cron - 0-6 where Sunday = 0, Monday = 1, ...., Saturday = 6. // Multiple values accepted in comma separated format - eg. 0,3 for Sunday and Wednesday // Validate rotate_day_of_week scheduledBackup::validateRotateDayOfWeek($sbParams['rotate_day_of_week']); // max_snapshots_per_group - The max tatal num of snapshots allowed in a group. // Only used with DAY_OF_WEEK rotate_method // We won't take any more incremental snapshots if we already have a total of this many snapshots for the group. // This prevents us just continuing to endlessly take incremental snapshots if the cron schedule is never running // the backup on the necessary day of the week for any reason. // Validate max_snapshots_per_group scheduledBackup::validateMaxSnapshotsPerGroup($sbParams['max_snapshots_per_group']); // backup_skip_fatal - If no snapshot is taken because we hit max_snapshots_per_group, but it is not the rotation day of week // consider it a fatal error. 0 for OFF or 1 for ON (default). This can happen if your backup never ran on the day it should have. // Validate backup_skip_fatal // if not set, assume 1 / Yes. if (!isset($sbParams['backup_skip_fatal'])) { $sbParams['backup_skip_fatal'] = 1; } scheduledBackup::validateBackupSkipFatal($sbParams['backup_skip_fatal']); break; // // AFTER_SNAPSHOT_COUNT options // // // AFTER_SNAPSHOT_COUNT options // case 'AFTER_SNAPSHOT_COUNT': // rotate_snapshot_no - We rotate on the snapshot after this many in a group. // Eg. if 7 and daily snapshots, you are creating a new group for the 8th. // Validate rotate_snapshot_no scheduledBackup::validateRotateSnapshotNo($sbParams['rotate_snapshot_no']); break; default: throw new Exception('rotatingBackupTaker->validateParams: ' . "Error: Could not find a method to validate this backups parameters. This should never happen."); } // GLOBAL rotate_method options... // max_snapshot_groups - The maximum number of groups of snapshots we will maintain. // If 2, we would throw away group 1 after successfully taking the SEED for the third group. // validate max_snapshot_groups // must be set.. scheduledBackup::validateMaxSnapshotGroups($sbParams['max_snapshot_groups']); // validate maintain_materialized_copy (if set) if (isset($sbParams['maintain_materialized_copy'])) { scheduledBackup::validateMaintainMaterializedCopy($sbParams['maintain_materialized_copy']); } // // If we made it this far, the backup parameters should be valid... proceed with the actual backup! // return true; }