You are here

function backup_migrate_destination_s3::s3_object in Backup and Migrate 6.2

Same name and namespace in other branches
  1. 8.2 includes/destinations.s3.inc \backup_migrate_destination_s3::s3_object()
  2. 8.3 includes/destinations.s3.inc \backup_migrate_destination_s3::s3_object()
  3. 6.3 includes/destinations.s3.inc \backup_migrate_destination_s3::s3_object()
  4. 7.3 includes/destinations.s3.inc \backup_migrate_destination_s3::s3_object()
  5. 7.2 includes/destinations.s3.inc \backup_migrate_destination_s3::s3_object()
5 calls to backup_migrate_destination_s3::s3_object()
backup_migrate_destination_s3::edit_form in includes/destinations.s3.inc
Get the form for the settings for this filter.
backup_migrate_destination_s3::load_file in includes/destinations.s3.inc
Load from the s3 destination.
backup_migrate_destination_s3::_delete_file in includes/destinations.s3.inc
Delete from the s3 destination.
backup_migrate_destination_s3::_list_files in includes/destinations.s3.inc
List all files from the s3 destination.
backup_migrate_destination_s3::_save_file in includes/destinations.s3.inc
Save to to the s3 destination.

File

includes/destinations.s3.inc, line 160
Functions to handle the s3 backup destination.

Class

backup_migrate_destination_s3
A destination for sending database backups to an s3 server.

Code

function s3_object() {

  // Try to use libraries module if available to find the path.
  if (function_exists('libraries_get_path')) {
    $library_paths[] = libraries_get_path('s3-php5-curl');
  }
  else {
    $library_paths[] = 'sites/all/libraries/s3-php5-curl';
  }
  $library_paths[] = drupal_get_path('module', 'backup_migrate') . '/includes/s3-php5-curl';
  $library_paths[] = drupal_get_path('module', 'backup_migrate') . '/includes';
  foreach ($library_paths as $path) {
    if (file_exists($path . '/S3.php')) {
      require_once $path . '/S3.php';
      if (!$this->s3 && !empty($this->dest_url['user'])) {
        $this->s3 = new S3($this->dest_url['user'], $this->dest_url['pass'], FALSE, $this->dest_url['host']);
      }
      return $this->s3;
    }
  }
  drupal_set_message(t('To back up to S3 you must download version 0.4 of the PHP S3 library from !link. Extract the S3.php file and add it the directory %dir.', array(
    '!link' => l('http://undesigned.org.za/2007/10/22/amazon-s3-php-class', 'http://undesigned.org.za/2007/10/22/amazon-s3-php-class'),
    '%dir' => 'sites/all/libraries/s3-php5-curl',
  )), 'error', FALSE);
  return NULL;
}