You are here

function _demo_dump in Demonstration site (Sandbox / Snapshot) 6

Same name and namespace in other branches
  1. 8 demo.module \_demo_dump()
  2. 7 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.
3 calls to _demo_dump()
demo_drush_create_snapshot in ./demo.drush.inc
Callback for drush command demo-create.
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 161
Demonstration Site administrative pages

Code

function _demo_dump($options) {

  // Increase PHP's max_execution_time for large dumps.
  @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.
  if (function_exists('drupal_chmod')) {
    drupal_chmod($fileconfig['infofile']);
    drupal_chmod($fileconfig['sqlfile']);
  }
  else {
    chmod($fileconfig['infofile'], 0664);
    chmod($fileconfig['sqlfile'], 0664);
  }

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