You are here

function backup_migrate_perform_restore in Backup and Migrate 5.0.x

Same name and namespace in other branches
  1. 8.4 backup_migrate.module \backup_migrate_perform_restore()
  2. 8.2 backup_migrate.module \backup_migrate_perform_restore()
  3. 8.3 backup_migrate.module \backup_migrate_perform_restore()
  4. 5.2 backup_migrate.module \backup_migrate_perform_restore()
  5. 6.3 backup_migrate.module \backup_migrate_perform_restore()
  6. 6.2 backup_migrate.module \backup_migrate_perform_restore()
  7. 7.3 backup_migrate.module \backup_migrate_perform_restore()
  8. 7.2 backup_migrate.module \backup_migrate_perform_restore()

Restore a source from a destination and file id.

Parameters

string $source_id:

string|array $destination_id:

string $file_id:

array $config:

2 calls to backup_migrate_perform_restore()
BackupMigrateRestoreForm::submitForm in src/Form/BackupMigrateRestoreForm.php
Form submission handler.
BackupRestoreForm::submitForm in src/Form/BackupRestoreForm.php
Form submission handler.

File

./backup_migrate.module, line 62
Primary hook implementations for Backup Migrate.

Code

function backup_migrate_perform_restore($source_id, $destination_id, $file_id = NULL, array $config = []) {
  try {

    // Retrieve the service.
    $bam = backup_migrate_get_service_object($config);

    // Run the backup.
    $bam
      ->restore($source_id, $destination_id, $file_id);
    \Drupal::messenger()
      ->addMessage(t('Restore Complete.'));
  } catch (Exception $e) {
    \Drupal::messenger()
      ->addMessage($e
      ->getMessage(), 'error');
    return;
  }
}