You are here

class backup_migrate_destination_nodesquirrel in Backup and Migrate 6.3

Same name and namespace in other branches
  1. 8.3 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel
  2. 6.2 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel
  3. 7.2 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel

A destination for sending database backups to the NodeSquirel backup service.

Hierarchy

Expanded class hierarchy of backup_migrate_destination_nodesquirrel

1 string reference to 'backup_migrate_destination_nodesquirrel'
backup_migrate_backup_migrate_destination_subtypes in includes/destinations.inc
Implementation of hook_backup_migrate_destination_subtypes().

File

includes/destinations.nodesquirrel.inc, line 141
Functions to handle the NodeSquirrel backup destination.

View source
class backup_migrate_destination_nodesquirrel extends backup_migrate_destination {
  var $supported_ops = array(
    'scheduled backup',
    'manual backup',
    'remote backup',
    'restore',
    'list files',
    'configure',
    'delete',
  );
  var $cache_files = TRUE;

  // Don't generate a metadata file as NodeSquirrel can save metadata natively.
  var $save_metadata = FALSE;

  /**
   * Get the destination name. Provide a default.
   */
  function get_name() {
    if (empty($this->name)) {
      return t('NodeSquirrel');
    }
    return $this->name;
  }

  /**
   * Get the menu items for manipulating this type.
   */
  function get_menu_items() {
    $items = array();
    $path = BACKUP_MIGRATE_MENU_PATH . '/nodesquirrel';
    $items[$path] = array(
      'title' => t('NodeSquirrel'),
      'page callback' => 'backup_migrate_menu_callback',
      'page arguments' => array(
        'destinations.nodesquirrel',
        'backup_migrate_nodesquirrel_settings',
      ),
      'access arguments' => array(
        'administer backup and migrate',
      ),
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
    return $items;
  }

  /**
   * Declare any mysql databases defined in the settings.php file as a possible destination.
   */
  function destinations() {
    $out = array();
    $out['nodesquirrel'] = backup_migrate_create_destination('nodesquirrel', array(
      'destination_id' => 'nodesquirrel',
    ));
    if ($secret_key = variable_get('nodesquirrel_secret_key', '')) {
      $out['nodesquirrel']->settings['secret_key'] = $secret_key;
    }
    else {
      $out['nodesquirrel']->supported_ops = array(
        'manual backup',
        'remote backup',
      );
    }
    return $out;
  }

  /**
   * Returns a form to be completed before saving to the destination can be complete.
   */
  function before_backup_form($settings) {
    $key = $this
      ->settings('secret_key');
    if (empty($key)) {
      return backup_migrate_nodesquirrel_credentials_settings_form();
    }
    return array();
  }

  /**
   * Validate the before_backup_form form.
   */
  function before_backup_form_validate($settings, $form, $form_state) {
    if (isset($form_state['values']['nodesquirrel_secret_key'])) {
      $key = trim($form_state['values']['nodesquirrel_secret_key']);
      if ($error = $this
        ->vaidate_key($key)) {
        form_set_error('secret_key', $error);
      }
    }
  }

  /**
   * Submit the before_backup_form form.
   */
  function before_backup_form_submit($settings, $form, $form_state) {
    if (isset($form_state['values']['nodesquirrel_secret_key'])) {
      $this->settings['secret_key'] = $form_state['values']['nodesquirrel_secret_key'];
      variable_set('nodesquirrel_secret_key', $this->settings['secret_key']);
    }
  }

  /**
   * Save to the NodeSquirrel destination.
   */
  function save_file($file, $settings) {
    if ($destination = $this
      ->_get_destination()) {
      srand((double) microtime() * 1000000);
      $filename = $file
        ->filename();
      $filesize = filesize($file
        ->filepath());
      $ticket = $this
        ->_xmlrpc('backups.getUploadTicket', array(
        $destination,
        $filename,
        $filesize,
        $file->file_info,
      ));
      if ($ticket) {
        $url = $ticket['url'];

        // If the ticket requires authentication add our username/password to the url.
        if (!empty($ticket['auth']) && ($ticket['auth'] = 'basic')) {
          $parts = parse_url($ticket['url']);
          list($parts['user'], $parts['pass']) = $this
            ->get_user_pass();
          $url = $this
            ->glue_url($parts, FALSE);
        }
        $out = $this
          ->_post_file($url, 'POST', $ticket['params'], $file);
        if ($out->code == 200) {

          // Confirm the upload.
          $confirm = $this
            ->_xmlrpc('backups.confirmUpload', array(
            $destination,
            $filename,
            $filesize,
          ));
          if ($confirm['success']) {

            // Set a message with a link to the manage console.
            _backup_migrate_message('Your backup has been saved to your NodeSquirrel account. View it at !account', array(
              '!account' => nodesquirrel_get_manage_link($this),
            ));
            return $file;
          }
          else {
            _backup_migrate_message('The backup file never made it to the NodeSquirrel backup server. There may have been a network problem. Please try again later');
          }
        }
        else {
          $error = !empty($out->headers['x-bams-error']) ? $out->headers['x-bams-error'] : $out->error;
          _backup_migrate_message('The NodeSquirrel server returned the following error: %err', array(
            '%err' => $error,
          ), 'error');
        }
      }
      else {
        if ($err = xmlrpc_error()) {

          // XMLRPC errors are already handled by the server function below.
        }
        else {
          _backup_migrate_message('The NodeSquirrel server refused the backup but did not specify why. Maybe the server is down.');
        }
      }
    }
    return NULL;
  }

  /**
   * Load from the NodeSquirrel destination.
   */
  function load_file($file_id) {
    if ($destination = $this
      ->_get_destination()) {
      backup_migrate_include('files');
      $file = new backup_file(array(
        'filename' => $file_id,
      ));
      $ticket = $this
        ->_xmlrpc('backups.getDownloadTicket', array(
        $destination,
        $file_id,
      ));
      if ($ticket && ($url = $ticket['url'])) {

        // If the ticket requires authentication add our username/password to the url.
        if (!empty($ticket['auth']) && ($ticket['auth'] = 'basic')) {
          $parts = parse_url($ticket['url']);
          $parts['user'] = @$this->dest_url['user'];
          $parts['pass'] = @$this->dest_url['pass'];
          $url = $this
            ->glue_url($parts, FALSE);
        }
        $out = drupal_http_request($url);
        if ($out->code == 200) {
          file_put_contents($file
            ->filepath(), $out->data);
          return $file;
        }
        else {
          $error = !empty($out->headers['x-bams-error']) ? $out->headers['x-bams-error'] : $out->error;
          _backup_migrate_message('The server returned the following error: %err', array(
            '%err' => $error,
          ), 'error');
        }
      }
    }
    return NULL;
  }

  /**
   * Delete from the NodeSquirrel destination.
   */
  function delete_file($file_id) {
    if ($destination = $this
      ->_get_destination()) {
      $result = $this
        ->_xmlrpc('backups.deleteFile', array(
        $destination,
        $file_id,
      ));
    }
  }

  /**
   * List the files in the remote destination.
   */
  function _list_files() {
    $files = array();
    backup_migrate_include('files');
    if ($destination = $this
      ->_get_destination()) {
      $file_list = $this
        ->_xmlrpc('backups.listFiles', array(
        $destination,
      ));
      foreach ((array) $file_list as $file) {
        $files[$file['filename']] = new backup_file($file);
      }
    }
    return $files;
  }

  /**
   * List the files in the remote destination.
   */
  function check_limits() {
    if (empty($this->limits)) {
      $this->limits = $this
        ->_xmlrpc('backups.getLimits', array(
        $this
          ->_get_destination(),
      ));
    }
    return $this->limits;
  }

  /**
   * Check that a destination is valid.
   */
  function confirm_destination() {
    return $this
      ->check_limits();
  }

  /**
   * Get the form for the settings for this destination.
   */
  function edit_form() {
    $form = parent::edit_form();
    $form['settings'] = array(
      '#tree' => TRUE,
    );
    $activate_link = nodesquirrel_get_activate_link();

    // Retrieve the key from the settings or get it from the get string if this is an auto-config action.
    $key = $this
      ->settings('secret_key');
    if (!empty($_GET['key']) && preg_match(NODESQUIRREL_SECRET_KEY_PATTERN, $_GET['key'])) {
      $key = $_GET['key'];
    }
    $form['settings']['secret_key'] = array(
      '#type' => 'textfield',
      '#title' => t('Secret Key'),
      '#default_value' => $key,
    );
    $form['settings']['location'] = array(
      '#type' => 'value',
      '#value' => '',
    );
    $form['settings']['secret_key_help'] = array(
      '#type' => 'item',
      '#title' => t('Need a Secret Key?'),
      '#value' => t('Visit !nodesquirrel.', array(
        '!nodesquirrel' => $activate_link,
      )),
    );
    return $form;
  }

  /**
   * Submit the configuration form. Glue the url together and add the old password back if a new one was not specified.
   */
  function edit_form_validate($form, &$form_state) {
    $key = trim($form_state['values']['settings']['secret_key']);
    if ($error = $this
      ->vaidate_key($key)) {
      form_set_error('secret_key', $error);
    }
  }

  /**
   * Validate a secret key. Returns error text if the key is invalid.
   */
  function vaidate_key($key) {
    $error = FALSE;
    if ($key) {
      if (!preg_match(NODESQUIRREL_SECRET_KEY_PATTERN, $key)) {
        return 'The secret key you entered is not the right format. Please make sure you copy it exactly.';
      }
      $this->settings['secret_key'] = check_plain($key);
      $limits = $this
        ->check_limits();
      if (!$limits) {
        $err = xmlrpc_error();
        if (!empty($err->code) && $err->code == '401') {
          return 'Could not log in to the NodeSquirrel server. Please check that your secret key is correct.';
        }
        else {
          return 'Your site could not be found on NodeSquirrel. Please check that your secret key is correct.';
        }
      }
    }
    else {
      return 'You must enter a NodeSquirrel secret key.';
    }
    return FALSE;
  }

  /**
   * Submit the configuration form. Glue the url together and add the old password back if a new one was not specified.
   */
  function edit_form_submit($form, &$form_state) {
    $form_state['values']['secret_key'] = check_plain($form_state['values']['settings']['secret_key']);
    parent::edit_form_submit($form, $form_state);
  }

  /**
   * Get the destination id or warn the user that it has not been set.
   */
  function _get_destination($warn = TRUE) {
    list($id, $key) = $this
      ->get_user_pass();
    return $id;
  }

  /**
   * Get the destination id or warn the user that it has not been set.
   */
  function _get_private_key($warn = TRUE) {
    list($id, $key) = $this
      ->get_user_pass();
    return $key;
  }

  /**
   * Break the secret key into the public/private key (user/pass).
   */
  function get_user_pass() {
    $key = $this
      ->settings('secret_key');

    // The username is the first 32 chars.
    $user = substr($key, 0, 32);

    // The pass is the last 32 chars. There may be a separating character.
    $pass = substr($key, strlen($key) - 32);
    return array(
      $user,
      $pass,
    );
  }
  function get_display_location() {
    return t('NodeSquirrel.com');
  }
  function add_scheme($url) {
    return 'https://' . $url;
  }

  /**
   * Get the form for the settings for this destination.
   */
  function _xmlrpc($method, $args = array()) {

    // Retrieve the severs or read them from a stored variable.
    $servers = $this
      ->_get_endpoints();

    // Do the actual call.
    return $this
      ->__xmlrpc($method, $args, $servers);
  }

  /**
   * Get the form for the settings for this destination.
   */
  function __xmlrpc($method, $args, $servers, $retry = 3) {
    if ($servers && --$retry > 0) {

      // Add the key authentication arguments if we can.
      if ($this
        ->_sign_request($args)) {

        // Add the method and url to match the function signiture of xmlrpc().
        array_unshift($args, $method);
        $url = reset($servers);

        // Try each available server in order.
        while ($url) {
          $url = $this
            ->add_scheme($url);
          array_unshift($args, $url);
          $out = call_user_func_array('xmlrpc', $args);

          // Check for errors.
          $err = xmlrpc_error();
          if ($err && $err->is_error) {
            switch ($err->code) {
              case '500':
              case '503':
              case '404':

                // Some sort of server error. Try the next one.
                $url = next($servers);

                // If we're at the end of the line then try refetching the urls
                if (!$url) {
                  $servers = $this
                    ->_get_endpoints(TRUE, $retry);
                  return $this
                    ->__xmlrpc($method, $args, $servers, $retry);
                }
                break;
              case '300':

                // 'Multiple Choices' means that the existing server list needs to be refreshed.
                $servers = $this
                  ->_get_endpoints(TRUE, $retry);
                return $this
                  ->__xmlrpc($method, $args, $servers, $retry);
                break;
              case '401':
              case '403':

                // Authentication failed.
                _backup_migrate_message('Couldn\'t log in to NodeSquirrel. The server error was: %err', array(
                  '%err' => $err->message,
                ), 'error');
                return FALSE;
                break;
              default:

                // Some sort of client error. Don't try the next server because it'll probably say the same thing.
                _backup_migrate_message('The NodeSquirrel server returned the following error: %err', array(
                  '%err' => $err->message,
                ), 'error');
                return FALSE;
                break;
            }
          }
          else {
            return $out;
          }

          // Remove the current url so the next one can be added.
          array_shift($args);
        }
      }
    }
  }

  /**
   * Genrate a hash with a given secret key, timestamp and random value.
   */
  function _get_hash($time, $nonce) {
    if ($private_key = $this
      ->_get_private_key()) {
      $message = $time . ':' . $nonce . ':' . $private_key;

      // Use HMAC-SHA1 to authenticate the call.
      $hash = base64_encode(pack('H*', sha1((str_pad($private_key, 64, chr(0x0)) ^ str_repeat(chr(0x5c), 64)) . pack('H*', sha1((str_pad($private_key, 64, chr(0x0)) ^ str_repeat(chr(0x36), 64)) . $message)))));
      return $hash;
    }
    _backup_migrate_message('You must enter a valid secret key to use NodeSquirrel.', array(), 'error');
    return FALSE;
  }

  /**
   * Genrate a hash with a given secret key, timestamp and random value.
   */
  function _sign_request(&$args) {
    $nonce = md5(mt_rand());
    $time = time();
    $hash = $this
      ->_get_hash($time, $nonce);
    if ($hash) {
      array_unshift($args, $nonce);
      array_unshift($args, $time);
      array_unshift($args, $hash);
      return TRUE;
    }
    else {
      return FALSE;
    }
  }

  /**
   * Retrieve the list of servers.
   */
  function _get_endpoints($refresh = FALSE, $retry = 3) {
    $servers = (array) variable_get('nodesquirrel_endpoint_urls', array());

    // No servers saved or a force refreshr required.
    if ($refresh || empty($servers)) {
      $servers = array_unique(array_merge($servers, variable_get('nodesquirrel_default_endpoint_urls', array(
        'api.nodesquirrel.com/services/xmlrpc',
      ))));

      // Call the get endpoints method but use the default or previous servers to avoid infinite loops.
      $new_servers = $this
        ->__xmlrpc('backups.getEndpoints', array(
        $this
          ->_get_destination(),
        'xmlrpc',
      ), $servers, $retry);
      if ($new_servers) {
        variable_set('nodesquirrel_endpoint_urls', $new_servers);
        $servers = $new_servers;
      }
    }
    return $servers;
  }

  /**
   * Post a file via http.
   *
   * This looks a lot like a clone of drupal_http_request but it can post a large
   * file without reading the whole file into memory.
   */
  function _post_file($url, $method = 'GET', $params = array(), $file = NULL, $retry = 3) {
    global $db_prefix;
    $result = new stdClass();

    // Parse the URL and make sure we can handle the schema.
    $uri = parse_url($url);
    if ($uri == FALSE) {
      $result->error = 'unable to parse URL';
      $result->code = -1001;
      return $result;
    }
    if (!isset($uri['scheme'])) {
      $result->error = 'missing schema';
      $result->code = -1002;
      return $result;
    }
    switch ($uri['scheme']) {
      case 'http':
      case 'feed':
        $port = isset($uri['port']) ? $uri['port'] : 80;
        $host = $uri['host'] . ($port != 80 ? ':' . $port : '');
        $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
        break;
      case 'https':

        // Note: Only works for PHP 4.3 compiled with OpenSSL.
        $port = isset($uri['port']) ? $uri['port'] : 443;
        $host = $uri['host'] . ($port != 443 ? ':' . $port : '');
        $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20);
        break;
      default:
        $result->error = 'invalid schema ' . $uri['scheme'];
        $result->code = -1003;
        return $result;
    }

    // Make sure the socket opened properly.
    if (!$fp) {

      // When a network error occurs, we use a negative number so it does not
      // clash with the HTTP status codes.
      $result->code = -$errno;
      $result->error = trim($errstr);

      // Mark that this request failed. This will trigger a check of the web
      // server's ability to make outgoing HTTP requests the next time that
      // requirements checking is performed.
      // @see system_requirements()
      variable_set('drupal_http_request_fails', TRUE);
      return $result;
    }

    // Construct the path to act on.
    $path = isset($uri['path']) ? $uri['path'] : '/';
    if (isset($uri['query'])) {
      $path .= '?' . $uri['query'];
    }

    // Prepare the data payload.
    $boundary = '---------------------------' . substr(md5(rand(0, 32000)), 0, 10);
    $data_footer = "\r\n--{$boundary}--\r\n";
    $data_header = '';
    foreach ($params as $key => $value) {
      $data_header .= "--{$boundary}\r\n";
      $data_header .= "Content-Disposition: form-data; name=\"" . $key . "\"\r\n";
      $data_header .= "\r\n" . $value . "\r\n";
      $data_header .= "--{$boundary}\r\n";
    }

    // Add the file header to the post payload.
    $data_header .= "--{$boundary}\r\n";
    $data_header .= "Content-Disposition: form-data; name=\"file\"; filename=\"" . $file
      ->filename() . "\"\r\n";
    $data_header .= "Content-Type: application/octet-stream;\r\n";
    $data_header .= "\r\n";

    // Calculate the content length.
    $content_length = strlen($data_header . $data_footer) + filesize($file
      ->filepath());

    //file_get_contents($file->filepath()));

    // Create HTTP request.
    $defaults = array(
      // RFC 2616: "non-standard ports MUST, default ports MAY be included".
      // We don't add the port to prevent from breaking rewrite rules checking the
      // host that do not take into account the port number.
      'Host' => "Host: {$host}",
      'Content-type' => "Content-type: multipart/form-data, boundary={$boundary}",
      'User-Agent' => 'User-Agent: NodeSquirrel Client/1.x (+http://www.nodesquirrel.com) (Drupal ' . VERSION . '; Backup and Migrate 2.x)',
      'Content-Length' => 'Content-Length: ' . $content_length,
    );

    // If the server url has a user then attempt to use basic authentication
    if (isset($uri['user'])) {
      $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
    }
    $request = $method . ' ' . $path . " HTTP/1.0\r\n";
    $request .= implode("\r\n", $defaults);
    $request .= "\r\n\r\n";
    $result->request = $request;

    // Write the headers and start of the headers
    fwrite($fp, $request);
    fwrite($fp, $data_header);

    // Copy the file 512k at a time to prevent memory issues.
    if ($fp_in = fopen($file
      ->filepath(), 'rb')) {
      while (!feof($fp_in)) {
        fwrite($fp, fread($fp_in, 1024 * 512));
      }
      $success = TRUE;
    }
    @fclose($fp_in);

    // Finish the write.
    fwrite($fp, $data_footer);

    // Fetch response.
    $response = '';
    while (!feof($fp) && ($chunk = fread($fp, 1024))) {
      $response .= $chunk;
    }
    fclose($fp);
    if (variable_get('debug_http_request', FALSE)) {
      drupal_debug(date('r'));
      drupal_debug($request);
      drupal_debug($response);
    }

    // Parse response.
    list($split, $result->data) = explode("\r\n\r\n", $response, 2);
    $split = preg_split("/\r\n|\n|\r/", $split);
    list($protocol, $code, $status_message) = explode(' ', trim(array_shift($split)), 3);
    $result->protocol = $protocol;
    $result->status_message = $status_message;
    $result->headers = array();

    // Parse headers.
    while ($line = trim(array_shift($split))) {
      list($header, $value) = explode(':', $line, 2);
      if (isset($result->headers[$header]) && $header == 'Set-Cookie') {

        // RFC 2109: the Set-Cookie response header comprises the token Set-
        // Cookie:, followed by a comma-separated list of one or more cookies.
        $result->headers[$header] .= ',' . trim($value);
      }
      else {
        $result->headers[$header] = trim($value);
      }
    }
    $responses = array(
      100 => 'Continue',
      101 => 'Switching Protocols',
      200 => 'OK',
      201 => 'Created',
      202 => 'Accepted',
      203 => 'Non-Authoritative Information',
      204 => 'No Content',
      205 => 'Reset Content',
      206 => 'Partial Content',
      300 => 'Multiple Choices',
      301 => 'Moved Permanently',
      302 => 'Found',
      303 => 'See Other',
      304 => 'Not Modified',
      305 => 'Use Proxy',
      307 => 'Temporary Redirect',
      400 => 'Bad Request',
      401 => 'Unauthorized',
      402 => 'Payment Required',
      403 => 'Forbidden',
      404 => 'Not Found',
      405 => 'Method Not Allowed',
      406 => 'Not Acceptable',
      407 => 'Proxy Authentication Required',
      408 => 'Request Time-out',
      409 => 'Conflict',
      410 => 'Gone',
      411 => 'Length Required',
      412 => 'Precondition Failed',
      413 => 'Request Entity Too Large',
      414 => 'Request-URI Too Large',
      415 => 'Unsupported Media Type',
      416 => 'Requested range not satisfiable',
      417 => 'Expectation Failed',
      500 => 'Internal Server Error',
      501 => 'Not Implemented',
      502 => 'Bad Gateway',
      503 => 'Service Unavailable',
      504 => 'Gateway Time-out',
      505 => 'HTTP Version not supported',
    );

    // RFC 2616 states that all unknown HTTP codes must be treated the same as the
    // base code in their class.
    if (!isset($responses[$code])) {
      $code = floor($code / 100) * 100;
    }
    switch ($code) {
      case 200:

      // OK
      case 304:

        // Not modified
        break;
      case 301:

      // Moved permanently
      case 302:

      // Moved temporarily
      case 307:

        // Moved temporarily
        $location = $result->headers['Location'];
        if ($retry) {
          $result = drupal_http_request($result->headers['Location'], $headers, $method, $data, --$retry);
          $result->redirect_code = $result->code;
        }
        $result->redirect_url = $location;
        break;
      default:
        $result->error = $status_message;
    }
    $result->code = $code;
    return $result;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
backup_migrate_destination::$cache_expire property
backup_migrate_destination::$db_table property Overrides backup_migrate_location::$db_table
backup_migrate_destination::$default_values property Overrides backup_migrate_location::$default_values
backup_migrate_destination::$destination_type property
backup_migrate_destination::$fetch_time property
backup_migrate_destination::$plural property Overrides backup_migrate_location::$plural
backup_migrate_destination::$singular property Overrides backup_migrate_location::$singular
backup_migrate_destination::$title_plural property Overrides backup_migrate_location::$title_plural
backup_migrate_destination::$title_singular property Overrides backup_migrate_location::$title_singular
backup_migrate_destination::$type_name property Overrides backup_migrate_location::$type_name
backup_migrate_destination::$weight property 1
backup_migrate_destination::can_delete_file function Determine if we can read the given file.
backup_migrate_destination::can_read_file function Determine if we can read the given file. Overrides backup_migrate_location::can_read_file 1
backup_migrate_destination::count_files function List all the available files in the given destination with their destination specific id.
backup_migrate_destination::create_info_file function Create an ini file and write the meta data.
backup_migrate_destination::delete_confirm_message function Get the message to send to the user when confirming the deletion of the item. Overrides backup_migrate_location::delete_confirm_message
backup_migrate_destination::file_cache_clear function Retrieve the file list.
backup_migrate_destination::file_cache_get function Retrieve the file list.
backup_migrate_destination::file_cache_set function Cache the file list.
backup_migrate_destination::file_exists function Check if a file exists in the given destination.
backup_migrate_destination::get_action_links function Get the action links for a destination. Overrides backup_migrate_location::get_action_links
backup_migrate_destination::get_file_links function Get the action links for a file on a given destination.
backup_migrate_destination::get_remote function Get a boolean representing if the destination is remote or local.
backup_migrate_destination::list_files function List all the available files in the given destination with their destination specific id.
backup_migrate_destination::load_files_info function Load up the file's metadata from the accompanying .info file if applicable.
backup_migrate_destination::save_file_info function Save the file metadata
backup_migrate_destination::settings_default function Get the form for the settings for this destination type. Overrides backup_migrate_location::settings_default
backup_migrate_destination::settings_form function Get the form for the settings for this destination. Overrides backup_migrate_location::settings_form
backup_migrate_destination::settings_form_submit function Submit the settings form. Any values returned will be saved. Overrides backup_migrate_location::settings_form_submit
backup_migrate_destination::settings_form_validate function Validate the form for the settings for this destination. Overrides backup_migrate_location::settings_form_validate 1
backup_migrate_destination::strings function This function is not supposed to be called. It is just here to help the po extractor out. Overrides backup_migrate_location::strings
backup_migrate_destination::_delete_file function Delete the file with the given destination specific id. 3
backup_migrate_destination::_file_info_file function Create the info file object.
backup_migrate_destination::_file_info_filename function Determine the file name of the info file for a file.
backup_migrate_destination::_save_file function Save the given file to the destination. 3
backup_migrate_destination_nodesquirrel::$cache_files property Overrides backup_migrate_destination::$cache_files
backup_migrate_destination_nodesquirrel::$save_metadata property
backup_migrate_destination_nodesquirrel::$supported_ops property Overrides backup_migrate_destination::$supported_ops
backup_migrate_destination_nodesquirrel::add_scheme function
backup_migrate_destination_nodesquirrel::before_backup_form function Returns a form to be completed before saving to the destination can be complete.
backup_migrate_destination_nodesquirrel::before_backup_form_submit function Submit the before_backup_form form.
backup_migrate_destination_nodesquirrel::before_backup_form_validate function Validate the before_backup_form form.
backup_migrate_destination_nodesquirrel::check_limits function List the files in the remote destination.
backup_migrate_destination_nodesquirrel::confirm_destination function Check that a destination is valid. Overrides backup_migrate_destination::confirm_destination
backup_migrate_destination_nodesquirrel::delete_file function Delete from the NodeSquirrel destination. Overrides backup_migrate_destination::delete_file
backup_migrate_destination_nodesquirrel::destinations function Declare any mysql databases defined in the settings.php file as a possible destination.
backup_migrate_destination_nodesquirrel::edit_form function Get the form for the settings for this destination. Overrides backup_migrate_destination::edit_form
backup_migrate_destination_nodesquirrel::edit_form_submit function Submit the configuration form. Glue the url together and add the old password back if a new one was not specified. Overrides backup_migrate_item::edit_form_submit
backup_migrate_destination_nodesquirrel::edit_form_validate function Submit the configuration form. Glue the url together and add the old password back if a new one was not specified. Overrides backup_migrate_item::edit_form_validate
backup_migrate_destination_nodesquirrel::get_display_location function Overrides backup_migrate_location::get_display_location
backup_migrate_destination_nodesquirrel::get_menu_items function Get the menu items for manipulating this type. Overrides backup_migrate_destination::get_menu_items
backup_migrate_destination_nodesquirrel::get_name function Get the destination name. Provide a default. Overrides backup_migrate_location::get_name
backup_migrate_destination_nodesquirrel::get_user_pass function Break the secret key into the public/private key (user/pass).
backup_migrate_destination_nodesquirrel::load_file function Load from the NodeSquirrel destination. Overrides backup_migrate_destination::load_file
backup_migrate_destination_nodesquirrel::save_file function Save to the NodeSquirrel destination. Overrides backup_migrate_destination::save_file
backup_migrate_destination_nodesquirrel::vaidate_key function Validate a secret key. Returns error text if the key is invalid.
backup_migrate_destination_nodesquirrel::_get_destination function Get the destination id or warn the user that it has not been set.
backup_migrate_destination_nodesquirrel::_get_endpoints function Retrieve the list of servers.
backup_migrate_destination_nodesquirrel::_get_hash function Genrate a hash with a given secret key, timestamp and random value.
backup_migrate_destination_nodesquirrel::_get_private_key function Get the destination id or warn the user that it has not been set.
backup_migrate_destination_nodesquirrel::_list_files function List the files in the remote destination. Overrides backup_migrate_destination::_list_files
backup_migrate_destination_nodesquirrel::_post_file function Post a file via http.
backup_migrate_destination_nodesquirrel::_sign_request function Genrate a hash with a given secret key, timestamp and random value.
backup_migrate_destination_nodesquirrel::_xmlrpc function Get the form for the settings for this destination.
backup_migrate_destination_nodesquirrel::__xmlrpc function Get the form for the settings for this destination.
backup_migrate_item::$settings_path property
backup_migrate_item::$show_in_list property
backup_migrate_item::$storage property
backup_migrate_item::all_items function Get all of the given items.
backup_migrate_item::decode_db_row function Decode a loaded db row (unserialize necessary fields).
backup_migrate_item::delete function Delete the item from the database.
backup_migrate_item::export function Return as an exported array of values.
backup_migrate_item::from_array function Load an existing item from an array.
backup_migrate_item::generate_id function Return a random (very very likely unique) string id for a new item.
backup_migrate_item::get function Get the member with the given key.
backup_migrate_item::get_actions function Get the rendered action links for a destination.
backup_migrate_item::get_default_values function Get the default values for standard parameters. 2
backup_migrate_item::get_id function Get the primary id for this item (if any is set).
backup_migrate_item::get_list function Get a table of all items of this type. 1
backup_migrate_item::get_list_header function Get header for a lost of this type.
backup_migrate_item::get_machine_name_field function Get the machine name field name from the schema.
backup_migrate_item::get_primary_key function Get the primary key field title from the schema.
backup_migrate_item::get_schema function Get the schema for the item type.
backup_migrate_item::get_serialized_fields function Return the fields which must be serialized before saving to the db.
backup_migrate_item::get_settings_path function Get the columns needed to list the type.
backup_migrate_item::item function A particular item.
backup_migrate_item::item_exists function A particular item.
backup_migrate_item::load_row function Load an existing item from an database (serialized) array.
backup_migrate_item::revert_confirm_message function Get the message to send to the user when confirming the deletion of the item.
backup_migrate_item::save function Save the item to the database.
backup_migrate_item::set_id function Set the primary id for this item (if any is set).
backup_migrate_item::show_in_list function Get the columns needed to list the type.
backup_migrate_item::to_array function Return as an array of values. 1
backup_migrate_item::unique_id function Make sure this item has a unique id. Should only be called for new items or the item will collide with itself.
backup_migrate_item::_merge_defaults function Merge parameters with the given defaults.
backup_migrate_item::__construct function Constructor, set the basic info pulled from the db or generated programatically. 4
backup_migrate_location::$subtype property
backup_migrate_location::backup_settings_default function Get the form for the settings for this filter. 2
backup_migrate_location::backup_settings_form function Get the form for the settings for this filter. 2
backup_migrate_location::backup_settings_form_submit function Submit the settings form. Any values returned will be saved.
backup_migrate_location::backup_settings_form_validate function Get the form for the settings for this filter.
backup_migrate_location::create function Create a new location of the correct type. Overrides backup_migrate_item::create
backup_migrate_location::file_types function Retrieve a list of filetypes supported by this source/destination. 2
backup_migrate_location::get_list_column_info function Get the columns needed to list the type. Overrides backup_migrate_item::get_list_column_info
backup_migrate_location::get_list_row function Get a row of data to be used in a list of items of this type. Overrides backup_migrate_item::get_list_row 1
backup_migrate_location::get_location function 3
backup_migrate_location::get_subtype_name function Get the type name of this location for display to the user.
backup_migrate_location::glue_url function Glue a URLs component parts back into a URL. 1
backup_migrate_location::location_types function Get the available location types. 1
backup_migrate_location::op function Does this location support the given operation.
backup_migrate_location::ops function
backup_migrate_location::remove_op function Remove the given op from the support list.
backup_migrate_location::restore_settings_default function Get the form for the settings for this filter.
backup_migrate_location::restore_settings_form function Get the form for the settings for this filter.
backup_migrate_location::restore_settings_form_submit function Submit the settings form. Any values returned will be saved.
backup_migrate_location::restore_settings_form_validate function Get the form for the settings for this filter.
backup_migrate_location::settings function
backup_migrate_location::set_location function 3
backup_migrate_location::set_name function
backup_migrate_location::set_url function Break a URL into it's component parts. 1
backup_migrate_location::url function Get a url from the parts. 1