function backup_migrate_destination_files::_save_file

cis7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)
cle7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)
elmsmedia7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)
icor7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)
meedjum_blog7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)
mooc7 destinations.file.inc backup_migrate_destination_files::_save_file($file, $settings)

File save destination callback.

Overrides backup_migrate_destination::_save_file

File

sites/all/modules/ulmus/backup_migrate/includes/destinations.file.inc, line 32
A destination type for saving locally to the server.

Class

backup_migrate_destination_files

Code

function _save_file($file, $settings) {
  if ($dir = $this->get_location()) {
    if ($dir = $this->check_dir($dir)) {
      $filepath = rtrim($dir, "/") . "/" . $file->filename();
      if (file_unmanaged_move($file->filepath(), $filepath)) {

        // chmod, chown and chgrp the file if needed.
        if ($chmod = $this->settings('chmod')) {
          if (!@drupal_chmod($filepath, octdec($chmod))) {
            _backup_migrate_message('Unable to set the file mode for: @file', array('@file' => $filepath), 'error');
          }
        }
        if ($chgrp = $this->settings('chgrp')) {
          if (!@chgrp($filepath, $chgrp)) {
            _backup_migrate_message('Unable to set the file group for: @file', array('@file' => $filepath), 'error');
          }
        }
        return $file;
      }
      else {
        _backup_migrate_message('Unable to save the file to the directory: @dir', array('@dir' => $dir), 'error');
      }
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.