You are here

public function backup_migrate_source_db::backup_settings_default in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 8.3 includes/sources.db.inc \backup_migrate_source_db::backup_settings_default()
  2. 6.3 includes/sources.db.inc \backup_migrate_source_db::backup_settings_default()

Get the default settings for this object.

Return value

array The default tables whose data can be ignored. These tables mostly contain info which can be easily reproducted (such as cache or search index) but also tables which can become quite bloated but are not necessarily extremely important to back up or migrate during development (such as access log and watchdog).

Overrides backup_migrate_location::backup_settings_default

File

includes/sources.db.inc, line 74
Functions to handle the direct to database destination.

Class

backup_migrate_source_db
A destination type for saving to a database server.

Code

public function backup_settings_default() {
  $all_tables = $this
    ->_get_table_names();

  // Basic modules that should be excluded.
  $basic = array(
    // Default core tables.
    'accesslog',
    'sessions',
    'watchdog',
    // Search module.
    'search_dataset',
    'search_index',
    'search_keywords_log',
    'search_total',
    // Devel module.
    'devel_queries',
    'devel_times',
  );

  // Identify all cache tables.
  $cache = array(
    'cache',
  );
  foreach ($all_tables as $table_name) {
    if (strpos($table_name, 'cache_') === 0) {
      $cache[] = $table_name;
    }
  }

  // Simpletest can create a lot of tables that do not need to be backed up,
  // but all of them start with the string 'simpletest' so they can be easily
  // excluded.
  $simpletest = array();
  foreach ($all_tables as $table_name) {
    if (strpos($table_name, 'simpletest') === 0) {
      $simpletest[] = $table_name;
    }
  }
  return array(
    'nodata_tables' => drupal_map_assoc(array_merge($basic, $cache, module_invoke_all('devel_caches'))),
    'exclude_tables' => $simpletest,
    'utils_lock_tables' => FALSE,
  );
}