You are here

function backup_migrate_destination_filesource::_restore_from_file_cli in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.3 includes/sources.filesource.inc \backup_migrate_destination_filesource::_restore_from_file_cli()
  2. 7.3 includes/sources.filesource.inc \backup_migrate_destination_filesource::_restore_from_file_cli()

Restore to this source.

1 call to backup_migrate_destination_filesource::_restore_from_file_cli()
backup_migrate_destination_filesource::restore_from_file in includes/sources.filesource.inc
Restore to this source.
1 method overrides backup_migrate_destination_filesource::_restore_from_file_cli()
backup_migrate_files_destination_archivesource::_restore_from_file_cli in includes/sources.archivesource.inc
Restore to this source.

File

includes/sources.filesource.inc, line 183
A destination type for saving locally to the server.

Class

backup_migrate_destination_filesource
A destination type for saving locally to the server.

Code

function _restore_from_file_cli($file, &$settings) {
  if (!empty($settings->filters['use_cli']) && function_exists('backup_migrate_exec')) {
    $temp = backup_migrate_temp_directory();
    backup_migrate_exec("tar -C %temp -xf %input", array(
      '%input' => $file
        ->filepath(),
      '%temp' => $temp,
    ));

    // Older B&M Files format included a base 'files' directory.
    if (file_exists($temp . '/files')) {
      $temp = $temp . '/files';
    }
    if (file_exists($temp . '/' . $file->name . '/files')) {
      $temp = $temp . '/files';
    }

    // Move the files from the temp directory.
    backup_migrate_exec("mv -rf %temp/* %output", array(
      '%output' => $this
        ->get_realpath(),
      '%temp' => $temp,
    ));
    return $file;
  }
  return FALSE;
}