You are here

function _demo_dump in Demonstration site (Sandbox / Snapshot) 7

Same name and namespace in other branches
  1. 8 demo.module \_demo_dump()
  2. 6 demo.admin.inc \_demo_dump()

Create a new snapshot.

Parameters

$options: A structured array of snapshot options:

  • 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.
2 calls to _demo_dump()
demo_dump in ./demo.module
Create a new snapshot.
demo_dump_form_submit in ./demo.admin.inc
Form submit handler for demo_dump_form().

File

./demo.admin.inc, line 206
Demonstration Site administrative pages.

Code

function _demo_dump($options) {

  // Load database specific functions.
  if (!demo_load_include()) {
    return FALSE;
  }

  // Increase PHP's max_execution_time for large dumps.
  drupal_set_time_limit(600);

  // Generate the info file.
  $info = demo_set_info($options);
  if (!$info) {
    return FALSE;
  }

  // Allow other modules to alter the dump options.
  $fileconfig = demo_get_fileconfig($info['filename']);
  drupal_alter('demo_dump', $options, $info, $fileconfig);

  // Perform database dump.
  if (!demo_dump_db($fileconfig['sqlfile'], $options)) {
    return FALSE;
  }

  // Adjust file permissions.
  drupal_chmod($fileconfig['infofile']);
  drupal_chmod($fileconfig['sqlfile']);

  // Allow other modules to act on successful dumps.
  module_invoke_all('demo_dump', $options, $info, $fileconfig);
  return $fileconfig;
}