You are here

protected function DrupalEncrypt::_encryptFile in Backup and Migrate 8.4

1 call to DrupalEncrypt::_encryptFile()
DrupalEncrypt::afterBackup in src/Filter/DrupalEncrypt.php

File

src/Filter/DrupalEncrypt.php, line 69

Class

DrupalEncrypt
Class DrupalEncrypt.

Namespace

BackupMigrate\Drupal\Filter

Code

protected function _encryptFile(BackupFileReadableInterface $from, BackupFileWritableInterface $to) {
  $path = drupal_realpath($from
    ->realpath());
  $out_path = drupal_realpath($to
    ->realpath());
  try {
    CryptoFile::encryptFileWithPassword($path, $out_path, $this
      ->confGet('encrypt_password'));
    $fileszc = filesize(drupal_realpath($to
      ->realpath()));
    $to
      ->setMeta('filesize', $fileszc);
    return TRUE;
  } catch (Exception $e) {
    return FALSE;
  }
}