You are here

function backup_migrate_profile_save_profile in Backup and Migrate 5.2

Update an existing profile or create a new one.

3 calls to backup_migrate_profile_save_profile()
backup_migrate_ui_manual_backup_form_submit in ./backup_migrate.module
Submit the form. Save the values as defaults if desired and output the backup file.
backup_migrate_ui_profile_configure_form_submit in includes/profiles.inc
Submit the profile configuration form.
_backup_migrate_setup_databaase_defaults in ./backup_migrate.install

File

includes/profiles.inc, line 55
All of the settings profiles handling code for Backup and Migrate.

Code

function backup_migrate_profile_save_profile(&$profile) {
  $nodata_tables = serialize(array_filter($profile['nodata_tables']));
  $exclude_tables = serialize(array_filter($profile['exclude_tables']));
  if ($profile['profile_id']) {
    db_query("UPDATE {backup_migrate_profiles} \n                 SET  name = '%s',\n                      source_id = '%s',\n                      exclude_tables = '%s',\n                      nodata_tables = '%s',\n                      filename = '%s',\n                      append_timestamp = %d,\n                      timestamp_format = '%s',\n                      compression = '%s'\n               WHERE profile_id = %d", $profile['name'], $profile['source_id'], $exclude_tables, $nodata_tables, $profile['filename'], $profile['append_timestamp'], $profile['timestamp_format'], $profile['compression'], $profile['profile_id']);
  }
  else {
    $profile['profile_id'] = db_next_id('{backup_migrate_profiles}_profile_id');
    db_query("INSERT INTO {backup_migrate_profiles} (profile_id, name, source_id, exclude_tables, nodata_tables, filename, append_timestamp, timestamp_format, compression) VALUES (%d, '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s')", $profile['profile_id'], $profile['name'], $profile['source_id'], $exclude_tables, $nodata_tables, $profile['filename'], $profile['append_timestamp'], $profile['timestamp_format'], $profile['compression']);
  }
  return $profile;
}