home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (destinations.browser.inc)

This example Drupal source code file (destinations.browser.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

array, backup_migrate_destination_browser, class, download, extends, file, function, out, params, parent::__construct, php, return, upload, var

The destinations.browser.inc Drupal example source code

<?php
// $Id: destinations.browser.inc,v 1.2.2.1 2010/01/16 21:02:57 ronan Exp $


/**
 * @file
 * Functions to handle the browser upload/download backup destination.
 */

/**
 * A destination type for browser upload/download.
 *
 * @ingroup backup_migrate_destinations
 */
class backup_migrate_destination_browser extends backup_migrate_destination {
  /**
   * Get a row of data to be used in a list of items of this type.
   */  
  function get_list_row() {
    // Return none as this type should not be displayed.
    return array();
  }
}

/**
 * A destination type for browser upload.
 *
 * @ingroup backup_migrate_destinations
 */
class backup_migrate_destination_browser_upload extends backup_migrate_destination_browser {
  var $supported_ops = array('restore');
  function __construct() {
    $params = array();
    $params['name'] = "Upload";
    $params['destination_id'] = 'upload';
    parent::__construct($params);
  }

  /**
   * File load destination callback.
   */
  function load_file($file_id) {
    backup_migrate_include('files');
    if ($file = file_save_upload('backup_migrate_restore_upload')) {
      $out = new backup_file(array('filepath' => $file->uri));
      backup_migrate_temp_files_add($file->uri);
      return $out;
    }
    return NULL;
  }
}

/**
 * A destination type for browser download.
 *
 * @ingroup backup_migrate_destinations
 */
class backup_migrate_destination_browser_download extends backup_migrate_destination_browser {
  var $supported_ops = array('manual backup');
  function __construct() {
    $params = array();
    $params['name'] = "Download";
    $params['destination_id'] = 'download';
    parent::__construct($params);
  }

  /**
   * File save destination callback.
   */
  function save_file($file, $settings) {
    backup_migrate_include('files');
    $file->transfer();
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal destinations.browser.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.