function backup_migrate_perform_backup in Backup and Migrate 5.2
Same name and namespace in other branches
- 8.4 backup_migrate.module \backup_migrate_perform_backup()
- 8.2 backup_migrate.module \backup_migrate_perform_backup()
- 8.3 backup_migrate.module \backup_migrate_perform_backup()
- 6.3 backup_migrate.module \backup_migrate_perform_backup()
- 6.2 backup_migrate.module \backup_migrate_perform_backup()
- 7.3 backup_migrate.module \backup_migrate_perform_backup()
- 7.2 backup_migrate.module \backup_migrate_perform_backup()
- 5.0.x backup_migrate.module \backup_migrate_perform_backup()
Perform a backup with the given settings.
3 calls to backup_migrate_perform_backup()
- backup_migrate_schedules_run in includes/
schedules.inc - Run the preconfigured schedules. Called on cron.
- 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_backup_with_defaults in ./
backup_migrate.module - Backup the database with the default settings.
File
- ./
backup_migrate.module, line 530 - Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (e.g. cache_*)
Code
function backup_migrate_perform_backup(&$settings) {
require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/destinations.inc';
require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/files.inc';
require_once './' . drupal_get_path('module', 'backup_migrate') . '/includes/db.inc';
// If not in 'safe mode', increase the maximum execution time:
if (!ini_get('safe_mode') && ini_get('max_execution_time') < 600) {
set_time_limit(600);
}
if ($settings['append_timestamp'] && $settings['timestamp_format']) {
$settings['filename'] .= "-" . date($settings['timestamp_format']);
}
$settings['filename'] = _backup_migrate_clean_filename($settings['filename']);
$source = backup_migrate_get_destination($settings['source_id']);
if (!$source) {
_backup_migrate_message("Could not run backup because the source '%source' is missing.", array(
'%source' => $settings['source_id'],
), 'error');
backup_migrate_temp_file("", TRUE);
return FALSE;
}
$file = backup_migrate_temp_file('sql');
if (!$file) {
_backup_migrate_message("Could not run backup because a temporary file could not be created.", array(), 'error');
backup_migrate_temp_file("", TRUE);
return FALSE;
}
$file = backup_migrate_db_backup($source, $file, $settings);
if (!$file) {
_backup_migrate_message("Could not backup the database.", array(), 'error');
backup_migrate_temp_file("", TRUE);
return FALSE;
}
$file = backup_migrate_file_compress($file, $settings);
if (!$file) {
_backup_migrate_message("Could not run backup because the backup file could not be compressed.", array(), 'error');
backup_migrate_temp_file("", TRUE);
return FALSE;
}
$file = backup_migrate_destination_save_file($file, $settings);
if (!$file) {
_backup_migrate_message("Could not run backup because the file could not be saved to the destination.", array(), 'error');
backup_migrate_temp_file("", TRUE);
return FALSE;
}
// Delete any temporary files we've created.
backup_migrate_temp_file("", TRUE);
return $file;
}