You are here

function backup_migrate_destination_email::save_file in Backup and Migrate 8.2

Same name and namespace in other branches
  1. 8.3 includes/destinations.email.inc \backup_migrate_destination_email::save_file()
  2. 6.3 includes/destinations.email.inc \backup_migrate_destination_email::save_file()
  3. 6.2 includes/destinations.email.inc \backup_migrate_destination_email::save_file()
  4. 7.3 includes/destinations.email.inc \backup_migrate_destination_email::save_file()
  5. 7.2 includes/destinations.email.inc \backup_migrate_destination_email::save_file()

Save to (ie. email the file) to the email destination.

Overrides backup_migrate_destination::save_file

File

includes/destinations.email.inc, line 20
Functions to handle the email backup destination.

Class

backup_migrate_destination_email
A destination for emailing database backups.

Code

function save_file($file, $settings) {
  $size = filesize($file
    ->filepath());
  $max = variable_get('backup_migrate_max_email_size', 20971520);
  if ($size > $max) {
    _backup_migrate_message('Could not email the file @file because it is @size and Backup and Migrate only supports emailing files smaller than @max.', array(
      '@file' => $file
        ->filename(),
      '@size' => format_size($size),
      '@max' => format_size($max),
    ), 'error');
    return FALSE;
  }
  $attachment = new stdClass();
  $attachment->filename = $file
    ->filename();
  $attachment->path = $file
    ->filepath();
  _backup_migrate_destination_email_mail_backup($attachment, $this
    ->get_location());
  return $file;
}