You are here

protected function DrupalEncrypt::decryptFile in Backup and Migrate 5.0.x

1 call to DrupalEncrypt::decryptFile()
DrupalEncrypt::beforeRestore in src/Drupal/Filter/DrupalEncrypt.php

File

src/Drupal/Filter/DrupalEncrypt.php, line 91

Class

DrupalEncrypt
@package Drupal\backup_migrate\Drupal\Filter

Namespace

Drupal\backup_migrate\Drupal\Filter

Code

protected function decryptFile(BackupFileReadableInterface $from, BackupFileWritableInterface $to) {
  $path = \Drupal::service('file_system')
    ->realpath($from
    ->realpath());
  $out_path = \Drupal::service('file_system')
    ->realpath($to
    ->realpath());
  try {
    CryptoFile::decryptFileWithPassword($path, $out_path, $this
      ->confGet('encrypt_password'));
    return TRUE;
  } catch (Exception $e) {
    return FALSE;
  }
}