You are here

function backup_migrate_filter_backup_restore::restore in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/filters.backup_restore.inc \backup_migrate_filter_backup_restore::restore()
  2. 6.3 includes/filters.backup_restore.inc \backup_migrate_filter_backup_restore::restore()
  3. 6.2 includes/filters.backup_restore.inc \backup_migrate_filter_backup_restore::restore()
  4. 7.3 includes/filters.backup_restore.inc \backup_migrate_filter_backup_restore::restore()
  5. 7.2 includes/filters.backup_restore.inc \backup_migrate_filter_backup_restore::restore()

Restore the data from to source specified in the settings.

Overrides backup_migrate_filter::restore

File

includes/filters.backup_restore.inc, line 136
This filter performs tha actual backup or restore operation. Not technically a filter per-se, but it does need to fit in the call chain.

Class

backup_migrate_filter_backup_restore
A filter backup or migrate the specified source.

Code

function restore($file, &$settings) {
  if ($source = $settings
    ->get_source()) {
    if (!empty($settings->filters['destinations'][$source
      ->get_id()])) {
      $settings->filters = (array) $settings->filters['destinations'][$source
        ->get_id()] + $settings->filters;
    }
    $num = $source
      ->restore_from_file($file, $settings);
    return $num ? $file : FALSE;
  }
  backup_migrate_restore_fail("Could not run restore because the source '%source' is missing.", array(
    '%source' => $settings->source_id,
  ), $settings);
  return FALSE;
}