You are here

function hook_demo_dump_alter in Demonstration site (Sandbox / Snapshot) 6

Same name and namespace in other branches
  1. 7 demo.api.php \hook_demo_dump_alter()

Alter snapshot options before a snapshot is created.

Parameters

&$options: A structured array consisting of submitted form values:

  • filename: The base output filename, without extension.
  • default: Whether to set this dump as new default snapshot.
  • description: A description for the snapshot. If a snapshot with the same name already exists and this is left blank, the new snapshot will reuse the existing description.
  • tables: An array of tables to dump, keyed by table name (including table prefix, if any). The value is an array of dump options:

    • schema: Whether to dump the table schema.
    • data: Whether to dump the table data.
1 invocation of hook_demo_dump_alter()
_demo_dump in ./demo.admin.inc
Create a new snapshot.

File

./demo.api.php, line 28
Documentation for Demonstration site module.

Code

function hook_demo_dump_alter(&$options) {

  // Only export the table schema of table cache_table, but not the data.
  // Commonly used for cache tables.
  $options['tables']['cache_table']['data'] = FALSE;

  // Completely ignore tables starting with a certain prefix.
  foreach ($options['tables'] as $table => $dump_options) {

    // Test if the table name starts with 'unrelated_'.
    if (strncmp($table, 'unrelated_', 10) == 0) {
      unset($options['tables'][$table]);
    }
  }
}