You are here

class backup_migrate_destination_db_mysql in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.2 includes/destinations.db.mysql.inc \backup_migrate_destination_db_mysql
  2. 8.3 includes/destinations.db.mysql.inc \backup_migrate_destination_db_mysql
  3. 6.2 includes/destinations.db.mysql.inc \backup_migrate_destination_db_mysql
  4. 7.2 includes/destinations.db.mysql.inc \backup_migrate_destination_db_mysql

A destination type for saving to a database server.

Hierarchy

Expanded class hierarchy of backup_migrate_destination_db_mysql

File

includes/destinations.db.mysql.inc, line 19
Functions to handle the direct to database destination.

View source
class backup_migrate_destination_db_mysql extends backup_migrate_destination_db {

  /**
   * The table's data keyed by table name.
   *
   * @var array
   */
  protected static $tableData = array();

  /**
   * The tables keyed by name.
   *
   * @var array
   */
  protected static $tableNames = array();

  /**
   * The views keyed by name.
   *
   * @var array
   */
  protected static $viewNames = array();

  /**
   *
   */
  public function type_name() {
    return t("MySQL Database");
  }

  /**
   * Return a list of backup filetypes.
   */
  public function file_types() {
    return array(
      "sql" => array(
        "extension" => "sql",
        "filemime" => "text/x-sql",
        "backup" => TRUE,
        "restore" => TRUE,
      ),
      "mysql" => array(
        "extension" => "mysql",
        "filemime" => "text/x-sql",
        "backup" => TRUE,
        "restore" => TRUE,
      ),
    );
  }

  /**
   * Declare any mysql databases defined in the settings.php file as a possible destination.
   */
  public function destinations() {
    $out = array();
    global $databases;
    foreach ((array) $databases as $db_key => $target) {
      foreach ((array) $target as $tgt_key => $info) {

        // Only mysql/mysqli supported by this destination.
        $key = $db_key . ':' . $tgt_key;
        if ($info['driver'] === 'mysql') {

          // Compile the database connection string.
          $url = 'mysql://';
          $url .= urlencode($info['username']) . ':' . urlencode($info['password']);
          $url .= '@';
          $url .= urlencode($info['host']);
          if (!empty($info['port'])) {
            $url .= ':' . $info['port'];
          }
          $url .= '/' . urlencode($info['database']);
          if ($destination = backup_migrate_create_destination('mysql', array(
            'url' => $url,
          ))) {

            // Treat the default database differently because it is probably
            // the only one available.
            if ($key == 'default:default') {
              $destination
                ->set_id('db');
              $destination
                ->set_name(t('Default Database'));

              // Dissalow backing up to the default database because that's confusing and potentially dangerous.
              $destination
                ->remove_op('scheduled backup');
              $destination
                ->remove_op('manual backup');
            }
            else {
              $destination
                ->set_id('db:' . $key);
              $destination
                ->set_name($key . ": " . $destination
                ->get_display_location());
            }
            $out[$destination
              ->get_id()] = $destination;
          }
        }
      }
    }
    return $out;
  }

  /**
   * Get the file type for to backup this destination to.
   */
  public function get_file_type_id() {
    return 'mysql';
  }

  /**
   * Get the form for the backup settings for this destination.
   */
  public function backup_settings_form($settings) {
    $form = parent::backup_settings_form($settings);
    $form['use_mysqldump'] = array(
      "#type" => "checkbox",
      "#title" => t("Use mysqldump command"),
      "#default_value" => !empty($settings['use_mysqldump']),
      "#description" => t("Use the mysqldump command line tool if available. This can be faster for large databases but will not work on all servers. Also exporting SQL views is not really solid with this option. EXPERIMENTAL"),
    );
    return $form;
  }

  /**
   * Backup the databases to a file.
   *
   *  Returns a list of sql commands, one command per line.
   *  That makes it easier to import without loading the whole file into memory.
   *  The files are a little harder to read, but human-readability is not a priority.
   */
  public function _backup_db_to_file($file, $settings) {
    if (!empty($settings->filters['use_mysqldump']) && $this
      ->_backup_db_to_file_mysqldump($file, $settings)) {
      return TRUE;
    }
    $lines = 0;
    $exclude = !empty($settings->filters['exclude_tables']) ? $settings->filters['exclude_tables'] : array();
    $nodata = !empty($settings->filters['nodata_tables']) ? $settings->filters['nodata_tables'] : array();
    if ($file
      ->open(TRUE)) {
      $file
        ->write($this
        ->_get_sql_file_header());
      $alltables = $this
        ->_get_tables();
      $allviews = $this
        ->_get_views();
      foreach ($alltables as $table) {
        if (_backup_migrate_check_timeout()) {
          return FALSE;
        }
        if ($table['name'] && !isset($exclude[$table['name']])) {
          $file
            ->write($this
            ->_get_table_structure_sql($table));
          $lines++;
          if (!in_array($table['name'], $nodata)) {
            $lines += $this
              ->_dump_table_data_sql_to_file($file, $table);
          }
        }
      }
      foreach ($allviews as $view) {
        if (_backup_migrate_check_timeout()) {
          return FALSE;
        }
        if ($view['name'] && !isset($exclude[$view['name']])) {
          $file
            ->write($this
            ->_get_view_create_sql($view));
        }
      }
      $file
        ->write($this
        ->_get_sql_file_footer());
      $file
        ->close();
      return $lines;
    }
    else {
      return FALSE;
    }
  }

  /**
   * Backup the databases to a file using the mysqldump command.
   */
  public function _backup_db_to_file_mysqldump($file, $settings) {
    $success = FALSE;
    $nodata_tables = array();
    $alltables = $this
      ->_get_tables();
    $command = 'mysqldump --result-file=%file --opt -Q --host=%host --port=%port --user=%user --password=%pass %db';
    $args = array(
      '%file' => $file
        ->filepath(),
      '%host' => $this->dest_url['host'],
      '%port' => !empty($this->dest_url['port']) ? $this->dest_url['port'] : '3306',
      '%user' => $this->dest_url['user'],
      '%pass' => $this->dest_url['pass'],
      '%db' => $this->dest_url['path'],
    );

    // Ignore the excluded and no-data tables.
    $db = $this->dest_url['path'];
    if (!empty($settings->filters['exclude_tables'])) {
      foreach ((array) $settings->filters['exclude_tables'] as $table) {
        if (isset($alltables[$table])) {
          $command .= ' --ignore-table=' . $db . '.' . $table;
        }
      }
    }
    if (!empty($settings->filters['nodata_tables'])) {
      foreach ((array) $settings->filters['nodata_tables'] as $table) {
        if (isset($alltables[$table])) {
          $nodata_tables[] = $table;
          $command .= ' --ignore-table=' . $db . '.' . $table;
        }
      }
    }
    $success = backup_migrate_exec($command, $args);

    // Get the nodata tables.
    if ($success && !empty($nodata_tables)) {
      $tables = implode(' ', array_unique($nodata_tables));
      $command = "mysqldump --no-data --opt -Q --host=%host --port=%port --user=%user --password=%pass %db {$tables} >> %file";
      $success = backup_migrate_exec($command, $args);
    }
    return $success;
  }

  /**
   * Backup the databases to a file.
   */
  public function _restore_db_from_file($file, $settings) {
    $num = 0;
    if ($file
      ->open() && ($conn = $this
      ->_get_db_connection())) {

      // Optionally drop all existing tables.
      if (!empty($settings->filters['utils_drop_all_tables'])) {
        $all_tables = $this
          ->_get_tables();
        $table_names = array_map('backup_migrate_array_name_value', $all_tables);
        $table_list = join(', ', $table_names);
        $stmt = $conn
          ->prepare("DROP TABLE IF EXISTS {$table_list};\n");
        $stmt
          ->execute();
      }

      // Read one line at a time and run the query.
      while ($line = $this
        ->_read_sql_command_from_file($file)) {
        if (_backup_migrate_check_timeout()) {
          return FALSE;
        }
        if ($line) {

          // Prepeare and exexute the statement instead of the api function to avoid substitution of '{' etc.
          $stmt = $conn
            ->prepare($line);
          $stmt
            ->execute();
          $num++;
        }
      }

      // Close the file with fclose/gzclose.
      $file
        ->close();
    }
    else {
      drupal_set_message(t("Unable to open file %file to restore database", array(
        "%file" => $file
          ->filepath(),
      )), 'error');
      $num = FALSE;
    }
    return $num;
  }

  /**
   * Read a multiline sql command from a file.
   *
   * Supports the formatting created by mysqldump, but won't handle multiline comments.
   */
  public function _read_sql_command_from_file($file) {
    $out = '';
    while ($line = $file
      ->read()) {
      $first2 = substr($line, 0, 2);
      $first3 = substr($line, 0, 3);

      // Ignore single line comments. This function doesn't support multiline comments or inline comments.
      if ($first2 != '--' && ($first2 != '/*' || $first3 == '/*!')) {
        $out .= ' ' . trim($line);

        // If a line ends in ; or */ it is a sql command.
        if (substr($out, strlen($out) - 1, 1) == ';') {
          return trim($out);
        }
      }
    }
    return trim($out);
  }

  /**
   * Get a list of tables in the database.
   */
  public function _get_table_names() {
    if (empty(static::$tableNames)) {
      static::$tableNames = $this
        ->query("SHOW FULL TABLES WHERE Table_Type = 'BASE TABLE'")
        ->fetchAllKeyed(0, 0);
    }
    return static::$tableNames;
  }

  /**
   * Get a list of views in the database.
   */
  public function _get_view_names() {
    if (empty(static::$viewNames)) {
      static::$viewNames = $this
        ->query("SHOW FULL TABLES WHERE Table_Type = 'VIEW'")
        ->fetchAllKeyed(0, 0);
    }
    return static::$viewNames;
  }

  /**
   * Lock the list of given tables in the database.
   */
  public function _lock_tables($tables) {
    if ($tables) {
      $tables_escaped = array();
      foreach ($tables as $table) {
        $tables_escaped[] = '`' . db_escape_table($table) . '`  WRITE';
      }
      $this
        ->query('LOCK TABLES ' . implode(', ', $tables_escaped));
    }
  }

  /**
   * Unlock all tables in the database.
   */
  public function _unlock_tables($settings) {
    $this
      ->query('UNLOCK TABLES');
  }

  /**
   * Get a list of table and view data in the db.
   */
  protected function get_table_data() {
    if (empty(static::$tableData)) {
      $tables = $this
        ->query('SHOW TABLE STATUS')
        ->fetchAll(PDO::FETCH_ASSOC);
      foreach ($tables as $table) {

        // Lowercase the keys because between Drupal 7.12 and 7.13/14 the
        // default query behavior was changed.
        // See: http://drupal.org/node/1171866
        $table = array_change_key_case($table);
        static::$tableData[$table['name']] = $table;
      }
    }
    return static::$tableData;
  }

  /**
   * Get a list of tables in the db.
   */
  public function _get_tables() {
    $out = array();
    foreach ($this
      ->get_table_data() as $table) {
      if (!empty($table['engine'])) {
        $out[$table['name']] = $table;
      }
    }
    return $out;
  }

  /**
   * Get a list of views in the db.
   */
  public function _get_views() {
    $out = array();
    foreach ($this
      ->get_table_data() as $table) {
      if (empty($table['engine'])) {
        $out[$table['name']] = $table;
      }
    }
    return $out;
  }

  /**
   * Get the sql for the structure of the given table.
   */
  public function _get_table_structure_sql($table) {
    $out = "";
    $result = $this
      ->query("SHOW CREATE TABLE `" . $table['name'] . "`", array(), array(
      'fetch' => PDO::FETCH_ASSOC,
    ));
    foreach ($result as $create) {

      // Lowercase the keys because between Drupal 7.12 and 7.13/14 the default query behavior was changed.
      // See: http://drupal.org/node/1171866
      $create = array_change_key_case($create);
      $out .= "DROP TABLE IF EXISTS `" . $table['name'] . "`;\n";

      // Remove newlines and convert " to ` because PDO seems to convert those for some reason.
      $out .= strtr($create['create table'], array(
        "\n" => ' ',
        '"' => '`',
      ));
      if ($table['auto_increment']) {
        $out .= " AUTO_INCREMENT=" . $table['auto_increment'];
      }
      $out .= ";\n";
    }
    return $out;
  }

  /**
   * Get the sql for the structure of the given table.
   */
  public function _get_view_create_sql($view) {
    $out = "";

    // Switch SQL mode to get rid of "CREATE ALGORITHM..." what requires more permissions + troubles with the DEFINER user.
    $sql_mode = $this
      ->query("SELECT @@SESSION.sql_mode")
      ->fetchField();
    $this
      ->query("SET sql_mode = 'ANSI'");
    $result = $this
      ->query("SHOW CREATE VIEW `" . $view['name'] . "`", array(), array(
      'fetch' => PDO::FETCH_ASSOC,
    ));
    $this
      ->query("SET SQL_mode = :mode", array(
      ':mode' => $sql_mode,
    ));
    foreach ($result as $create) {
      $out .= "DROP VIEW IF EXISTS `" . $view['name'] . "`;\n";
      $out .= "SET sql_mode = 'ANSI';\n";
      $out .= strtr($create['Create View'], "\n", " ") . ";\n";
      $out .= "SET sql_mode = '{$sql_mode}';\n";
    }
    return $out;
  }

  /**
   * Get the sql to insert the data for a given table.
   */
  public function _dump_table_data_sql_to_file($file, $table) {
    $rows_per_query = variable_get('backup_migrate_data_rows_per_query', BACKUP_MIGRATE_DATA_ROWS_PER_QUERY);
    $rows_per_line = variable_get('backup_migrate_data_rows_per_line', BACKUP_MIGRATE_DATA_ROWS_PER_LINE);
    $bytes_per_line = variable_get('backup_migrate_data_bytes_per_line', BACKUP_MIGRATE_DATA_BYTES_PER_LINE);
    if (variable_get('backup_migrate_verbose')) {
      _backup_migrate_message('Table: %table', array(
        '%table' => $table['name'],
      ), 'success');
    }

    // Escape backslashes, PHP code, special chars.
    $search = array(
      '\\',
      "'",
      "\0",
      "\n",
      "\r",
      "\32",
    );
    $replace = array(
      '\\\\',
      "''",
      '\\0',
      '\\n',
      '\\r',
      '\\Z',
    );
    $lines = 0;
    $from = 0;
    $args = array(
      'fetch' => PDO::FETCH_ASSOC,
    );
    while ($data = $this
      ->query("SELECT * FROM `" . $table['name'] . "`", array(), $args, $from, $rows_per_query)) {
      if ($data
        ->rowCount() == 0) {
        break;
      }
      $rows = $bytes = 0;
      $line = array();
      foreach ($data as $row) {
        $from++;

        // DB Escape the values.
        $items = array();
        foreach ($row as $key => $value) {
          $items[] = is_null($value) ? "null" : "'" . str_replace($search, $replace, $value) . "'";
        }

        // If there is a row to be added.
        if ($items) {

          // Start a new line if we need to.
          if ($rows == 0) {
            $file
              ->write("INSERT INTO `" . $table['name'] . "` VALUES ");
            $bytes = $rows = 0;
          }
          else {
            $file
              ->write(",");
          }

          // Write the data itself.
          $sql = implode(',', $items);
          $file
            ->write('(' . $sql . ')');
          $bytes += strlen($sql);
          $rows++;

          // Finish the last line if we've added enough items.
          if ($rows >= $rows_per_line || $bytes >= $bytes_per_line) {
            $file
              ->write(";\n");
            $lines++;
            $bytes = $rows = 0;
          }
        }
      }

      // Finish any unfinished insert statements.
      if ($rows > 0) {
        $file
          ->write(";\n");
        $lines++;
      }
    }
    if (variable_get('backup_migrate_verbose')) {
      _backup_migrate_message('Peak memory usage: %mem', array(
        '%mem' => backup_migrate_get_peak_memory_usage() . 'MB',
      ), 'success');
    }
    return $lines;
  }

  /**
   * Get the db connection for the specified db.
   */
  public function _get_db_connection() {
    if (!$this->connection) {
      $this->connection = parent::_get_db_connection();
    }
    return $this->connection;
  }

  /**
   * Run a query on this destination's database using Drupal's MySQL engine.
   *
   * @param string $query
   *   The query string.
   * @param array $args
   *   Arguments for the query.
   * @param array $options
   *   Options to pass to the query.
   * @param int|null $from
   *   The starting point for the query; when passed will perform a queryRange()
   *   method instead of a regular query().
   * @param int|null $count
   *   The number of records to obtain from this query. Will be ignored if the
   *   $from argument is empty.
   *
   * @see DatabaseConnection_mysql::query()
   * @see DatabaseConnection_mysql::queryRange()
   */
  public function query($query, array $args = array(), array $options = array(), $from = NULL, $count = NULL) {
    if ($conn = $this
      ->_get_db_connection()) {

      // If no $from is passed in, just do a basic query.
      if (is_null($from)) {
        return $conn
          ->query($query, $args, $options);
      }
      else {
        return $conn
          ->queryRange($query, $from, $count, $args, $options);
      }
    }
  }

  /**
   * The header for the top of the sql dump file. These commands set the connection
   *  character encoding to help prevent encoding conversion issues.
   */
  public function _get_sql_file_header() {
    return "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;\n\nSET NAMES utf8mb4;\n\n";
  }

  /**
   * The footer of the sql dump file.
   */
  public function _get_sql_file_footer() {
    return "\n\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;\n/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n";
  }

}

Members

Namesort descending Modifiers Type Description Overrides
backup_migrate_destination::$cache_expire public property 24 hours, i.e. 24 * 60 * 60 seconds.
backup_migrate_destination::$cache_files public property 1
backup_migrate_destination::$db_table public property Overrides backup_migrate_location::$db_table
backup_migrate_destination::$default_values public property Overrides backup_migrate_location::$default_values
backup_migrate_destination::$destination_type public property
backup_migrate_destination::$fetch_time public property
backup_migrate_destination::$plural public property Overrides backup_migrate_location::$plural
backup_migrate_destination::$singular public property Overrides backup_migrate_location::$singular
backup_migrate_destination::$title_plural public property Overrides backup_migrate_location::$title_plural
backup_migrate_destination::$title_singular public property Overrides backup_migrate_location::$title_singular
backup_migrate_destination::$type_name public property Overrides backup_migrate_location::$type_name
backup_migrate_destination::$weight public property 1
backup_migrate_destination::can_delete_file public function Determine if we can read the given file.
backup_migrate_destination::can_read_file public function Determine if we can read the given file. Overrides backup_migrate_location::can_read_file 1
backup_migrate_destination::confirm_destination public function Check that a destination is valid. 1
backup_migrate_destination::count_files public function Count all the available files in the given destination.
backup_migrate_destination::create_info_file public function Create an ini file and write the meta data.
backup_migrate_destination::delete_confirm_message public function Get a message to send to the user when confirming the deletion of the item. Overrides backup_migrate_location::delete_confirm_message
backup_migrate_destination::delete_file public function Delete the file with the given destination specific id.
backup_migrate_destination::file_cache_clear public function Retrieve the file list.
backup_migrate_destination::file_cache_get public function Retrieve the file list.
backup_migrate_destination::file_cache_set public function Cache the file list.
backup_migrate_destination::file_exists public function Check if the file exists in the list of available files.
backup_migrate_destination::get_action_links public function Get the action links for a destination. Overrides backup_migrate_location::get_action_links
backup_migrate_destination::get_file_links public function Get the action links for a file on a given destination.
backup_migrate_destination::get_menu_items public function Add the menu items specific to the destination type. Overrides backup_migrate_item::get_menu_items
backup_migrate_destination::get_remote public function Get a boolean representing if the destination is remote or local.
backup_migrate_destination::list_files public function List all the available files in the given destination.
backup_migrate_destination::load_file public function Load the file with the given destination specific ID. 4
backup_migrate_destination::load_files_info public function Load up the file's metadata from the accompanying .info file if applicable.
backup_migrate_destination::save_file_info public function Save the file metadata.
backup_migrate_destination::settings_default public function Get the form for the settings for this destination type. Overrides backup_migrate_location::settings_default
backup_migrate_destination::settings_form public function Get the form for the settings for this destination. Overrides backup_migrate_location::settings_form
backup_migrate_destination::settings_form_submit public function Submit the settings form. Any values returned will be saved. Overrides backup_migrate_location::settings_form_submit
backup_migrate_destination::settings_form_validate public function Validate the form for the settings for this destination. Overrides backup_migrate_location::settings_form_validate 1
backup_migrate_destination::strings public function This function is not supposed to be called. Overrides backup_migrate_location::strings
backup_migrate_destination::_delete_file public function Delete the file with the given destination specific id. 3
backup_migrate_destination::_file_info_file public function Create the info file object.
backup_migrate_destination::_file_info_filename public function Determine the file name of the info file for a file.
backup_migrate_destination::_list_files public function List all the available files in the given destination. 3
backup_migrate_destination::_save_file public function Save the given file to the destination. 3
backup_migrate_destination_db::$connection public property
backup_migrate_destination_db::$db_target public property
backup_migrate_destination_db::$supported_ops public property Overrides backup_migrate_destination::$supported_ops
backup_migrate_destination_db::backup_settings_default public function Get the default settings for this object. Overrides backup_migrate_location::backup_settings_default
backup_migrate_destination_db::backup_to_file public function Backup from this source.
backup_migrate_destination_db::edit_form public function Destination configuration callback. Overrides backup_migrate_destination_remote::edit_form
backup_migrate_destination_db::edit_form_validate public function Validate the configuration form. Make sure the db info is valid. Overrides backup_migrate_item::edit_form_validate
backup_migrate_destination_db::get_object_names public function Get a list of objects in the database.
backup_migrate_destination_db::get_table_names public function Get a list of tables in the database.
backup_migrate_destination_db::lock_tables public function Lock the database in anticipation of a backup.
backup_migrate_destination_db::restore_from_file public function Restore to this source.
backup_migrate_destination_db::save_file public function Save the info by importing it into the database. Overrides backup_migrate_destination::save_file
backup_migrate_destination_db::unlock_tables public function Unlock any tables that have been locked.
backup_migrate_destination_db_mysql::$tableData protected static property The table's data keyed by table name.
backup_migrate_destination_db_mysql::$tableNames protected static property The tables keyed by name.
backup_migrate_destination_db_mysql::$viewNames protected static property The views keyed by name.
backup_migrate_destination_db_mysql::backup_settings_form public function Get the form for the backup settings for this destination. Overrides backup_migrate_destination_db::backup_settings_form
backup_migrate_destination_db_mysql::destinations public function Declare any mysql databases defined in the settings.php file as a possible destination.
backup_migrate_destination_db_mysql::file_types public function Return a list of backup filetypes. Overrides backup_migrate_location::file_types
backup_migrate_destination_db_mysql::get_file_type_id public function Get the file type for to backup this destination to. Overrides backup_migrate_destination_db::get_file_type_id
backup_migrate_destination_db_mysql::get_table_data protected function Get a list of table and view data in the db.
backup_migrate_destination_db_mysql::query public function Run a query on this destination's database using Drupal's MySQL engine.
backup_migrate_destination_db_mysql::type_name public function Overrides backup_migrate_destination_db::type_name
backup_migrate_destination_db_mysql::_backup_db_to_file public function Backup the databases to a file. Overrides backup_migrate_destination_db::_backup_db_to_file
backup_migrate_destination_db_mysql::_backup_db_to_file_mysqldump public function Backup the databases to a file using the mysqldump command.
backup_migrate_destination_db_mysql::_dump_table_data_sql_to_file public function Get the sql to insert the data for a given table.
backup_migrate_destination_db_mysql::_get_db_connection public function Get the db connection for the specified db. Overrides backup_migrate_destination_db::_get_db_connection
backup_migrate_destination_db_mysql::_get_sql_file_footer public function The footer of the sql dump file.
backup_migrate_destination_db_mysql::_get_sql_file_header public function The header for the top of the sql dump file. These commands set the connection character encoding to help prevent encoding conversion issues.
backup_migrate_destination_db_mysql::_get_tables public function Get a list of tables in the db.
backup_migrate_destination_db_mysql::_get_table_names public function Get a list of tables in the database. Overrides backup_migrate_destination_db::_get_table_names
backup_migrate_destination_db_mysql::_get_table_structure_sql public function Get the sql for the structure of the given table.
backup_migrate_destination_db_mysql::_get_views public function Get a list of views in the db.
backup_migrate_destination_db_mysql::_get_view_create_sql public function Get the sql for the structure of the given table.
backup_migrate_destination_db_mysql::_get_view_names public function Get a list of views in the database.
backup_migrate_destination_db_mysql::_lock_tables public function Lock the list of given tables in the database. Overrides backup_migrate_destination_db::_lock_tables
backup_migrate_destination_db_mysql::_read_sql_command_from_file public function Read a multiline sql command from a file.
backup_migrate_destination_db_mysql::_restore_db_from_file public function Backup the databases to a file. Overrides backup_migrate_destination_db::_restore_db_from_file
backup_migrate_destination_db_mysql::_unlock_tables public function Unlock all tables in the database. Overrides backup_migrate_destination_db::_unlock_tables
backup_migrate_destination_remote::edit_form_submit public function Submit the configuration form. Overrides backup_migrate_item::edit_form_submit 1
backup_migrate_destination_remote::get_display_location public function The location to display is the url without the password. Overrides backup_migrate_location::get_display_location
backup_migrate_destination_remote::get_location public function The location is a URI so parse it and store the parts. Overrides backup_migrate_location::get_location
backup_migrate_destination_remote::set_location public function Return the location with the password. Overrides backup_migrate_location::set_location
backup_migrate_item::$settings_path public property
backup_migrate_item::$show_in_list public property
backup_migrate_item::$storage public property
backup_migrate_item::all_items public function Get all of the given items.
backup_migrate_item::decode_db_row public function Decode a loaded db row (unserialize necessary fields).
backup_migrate_item::delete public function Delete the item from the database.
backup_migrate_item::export public function Return as an exported array of values.
backup_migrate_item::from_array public function Load an existing item from an array.
backup_migrate_item::generate_id public function Return a random (very very likely unique) string id for a new item.
backup_migrate_item::get public function Get the member with the given key.
backup_migrate_item::get_actions public function Get the rendered action links for a destination.
backup_migrate_item::get_default_values public function Get the default values for standard parameters. 2
backup_migrate_item::get_id public function Get the primary id for this item (if any is set).
backup_migrate_item::get_list public function Get a table of all items of this type. 1
backup_migrate_item::get_list_header public function Get header for a lost of this type.
backup_migrate_item::get_machine_name_field public function Get the machine name field name from the schema.
backup_migrate_item::get_primary_key public function Get the primary key field title from the schema.
backup_migrate_item::get_schema public function Get the schema for the item type.
backup_migrate_item::get_serialized_fields public function Return the fields which must be serialized before saving to the db.
backup_migrate_item::get_settings_path public function Get the columns needed to list the type. 1
backup_migrate_item::item public function A particular item.
backup_migrate_item::item_exists public function A particular item.
backup_migrate_item::load_row public function Load an existing item from an database (serialized) array.
backup_migrate_item::revert_confirm_message public function The message to send to the user when confirming the deletion of the item.
backup_migrate_item::save public function Save the item to the database.
backup_migrate_item::set_id public function Set the primary id for this item (if any is set).
backup_migrate_item::show_in_list public function Get the columns needed to list the type.
backup_migrate_item::to_array public function Return as an array of values. 1
backup_migrate_item::unique_id public function Make sure this item has a unique id.
backup_migrate_item::_merge_defaults public function Merge parameters with the given defaults.
backup_migrate_item::__construct public function Set the basic info pulled from the db or generated programatically. 5
backup_migrate_location::$subtype public property
backup_migrate_location::backup_settings_form_submit public function Submit the settings form. Any values returned will be saved.
backup_migrate_location::backup_settings_form_validate public function Get the form for the settings for this filter.
backup_migrate_location::create public function Create a new location of the correct type. Overrides backup_migrate_item::create
backup_migrate_location::get_list_column_info public function Get the columns needed to list the type. Overrides backup_migrate_item::get_list_column_info
backup_migrate_location::get_list_row public 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_name public function Get the name of the item. Overrides backup_migrate_item::get_name
backup_migrate_location::get_subtype_name public function Get the type name of this location for display to the user.
backup_migrate_location::glue_url public function Glue a URLs component parts back into a URL.
backup_migrate_location::location_types public function Get the available location types. 1
backup_migrate_location::op public function Does this location support the given operation.
backup_migrate_location::ops public function
backup_migrate_location::remove_op public function Remove the given op from the support list.
backup_migrate_location::restore_settings_default public function Get the form for the settings for this filter.
backup_migrate_location::restore_settings_form public function Get the form for the settings for this filter.
backup_migrate_location::restore_settings_form_submit public function Submit the settings form. Any values returned will be saved.
backup_migrate_location::restore_settings_form_validate public function Get the form for the settings for this filter.
backup_migrate_location::settings public function
backup_migrate_location::set_name public function
backup_migrate_location::set_url public function Break a URL into it's component parts.
backup_migrate_location::url public function Get a url from the parts.