function _backup_migrate_get_dump_sql in Backup and Migrate 5
Same name and namespace in other branches
- 5.2 includes/db.inc \_backup_migrate_get_dump_sql()
- 6 backup_migrate.module \_backup_migrate_get_dump_sql()
Get the sql dump file. Returns a list of sql commands, one command per line. That makes it easier to import without loading the whole file into memory. The files are a little harder to read, but human-readability is not a priority
1 call to _backup_migrate_get_dump_sql()
- _backup_migrate_dump_tables in ./
backup_migrate.module - Build the database dump file. Takes a list of tables to exclude and some formatting options.
File
- ./
backup_migrate.module, line 598 - Create (manually or scheduled) and restore backups of your Drupal MySQL database with an option to exclude table data (f.e. cache_*)
Code
function _backup_migrate_get_dump_sql($file, $exclude_tables, $nodata_tables) {
if ($dst = fopen($file, "w")) {
fwrite($dst, _backup_migrate_get_sql_file_header());
$alltables = _backup_migrate_get_tables();
foreach ($alltables as $table) {
if ($table['Name'] && !isset($exclude_tables[$table['Name']])) {
fwrite($dst, _backup_migrate_get_table_structure_sql($table));
if (!in_array($table['Name'], $nodata_tables)) {
_backup_migrate_dump_table_data_sql_to_handle($dst, $table);
}
}
}
fwrite($dst, _backup_migrate_get_sql_file_footer());
fclose($dst);
return TRUE;
}
else {
return FALSE;
}
}