function _demo_dump in Demonstration site (Sandbox / Snapshot) 8
Same name and namespace in other branches
- 6 demo.admin.inc \_demo_dump()
- 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.
1 call to _demo_dump()
- DemoDumpForm::submitForm in src/
Form/ DemoDumpForm.php - create the database.
File
- ./
demo.module, line 565
Code
function _demo_dump($options) {
// 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::moduleHandler()
->alter('demo_dump', $options, $info, $fileconfig);
// Set default snapshot
if ($options['default']) {
\Drupal::service('config.factory')
->getEditable('demo.settings')
->set('demo_dump_cron', $info['filename'])
->save();
}
// 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.
Drupal::moduleHandler()
->invokeAll('demo_dump', [
$options,
$info,
$fileconfig,
]);
return $fileconfig;
}