function backup_migrate_file_decompress in Backup and Migrate 5.2
Decompress a file with the given settings. Also updates settings to reflect new file mime and file extension.
1 call to backup_migrate_file_decompress()
- backup_migrate_perform_restore_file in ./
backup_migrate.module - Restore from a file in the given destination.
File
- includes/
files.inc, line 52 - General file handling code for Backup and Migrate.
Code
function backup_migrate_file_decompress(&$file) {
$success = FALSE;
$temp_sql = backup_migrate_temp_file('sql');
switch ($file['type']) {
case "sql":
return $file;
break;
case "gzip":
$success = _backup_migrate_gzip_decode($file['filepath'], $temp_sql);
break;
case "bzip":
$success = _backup_migrate_bzip_decode($file['filepath'], $temp_sql);
break;
case "zip":
$success = _backup_migrate_zip_decode($file['filepath'], $temp_sql);
break;
}
if ($success) {
$file['filepath'] = $temp_sql;
$file = backup_migrate_file_info($file['filepath']);
}
else {
_backup_migrate_message("Could not decompress backup file. Please check that the file is valid.", array(), 'error');
}
return $success ? $file : NULL;
}