You are here

function backup_migrate_destination_filesource::_restore_from_file_php 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_php()
  2. 7.3 includes/sources.filesource.inc \backup_migrate_destination_filesource::_restore_from_file_php()

Restore to this source.

1 call to backup_migrate_destination_filesource::_restore_from_file_php()
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_php()
backup_migrate_files_destination_archivesource::_restore_from_file_php in includes/sources.archivesource.inc
Restore to this source.

File

includes/sources.filesource.inc, line 156
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_php($file, &$settings) {
  if ($this
    ->check_libs()) {
    $from = $file
      ->pop_type();
    $temp = backup_migrate_temp_directory();
    $tar = new Archive_Tar($from
      ->filepath());
    $tar
      ->extractModify($temp, $file->name);

    // 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_move_files($temp, $this
      ->get_realpath());
    return $file;
  }
  return FALSE;
}