Merge pull request #6218 from marc1706/ticket/16783

[ticket/16783] Remove structure only backup
This commit is contained in:
Marc Alexander 2021-05-29 20:05:43 +02:00
commit f007aef3d8
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
3 changed files with 4 additions and 24 deletions

View file

@ -58,7 +58,6 @@
<dl> <dl>
<dt><label for="type">{L_BACKUP_TYPE}{L_COLON}</label></dt> <dt><label for="type">{L_BACKUP_TYPE}{L_COLON}</label></dt>
<dd><label><input type="radio" class="radio" name="type" value="full" id="type" checked="checked" /> {L_FULL_BACKUP}</label> <dd><label><input type="radio" class="radio" name="type" value="full" id="type" checked="checked" /> {L_FULL_BACKUP}</label>
<label><input type="radio" name="type" class="radio" value="structure" /> {L_STRUCTURE_ONLY}</label>
<label><input type="radio" class="radio" name="type" value="data" /> {L_DATA_ONLY}</label></dd> <label><input type="radio" class="radio" name="type" value="data" /> {L_DATA_ONLY}</label></dd>
</dl> </dl>
<dl> <dl>

View file

@ -69,20 +69,6 @@ class acp_database
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
$store = true;
$structure = false;
$schema_data = false;
if ($type == 'full' || $type == 'structure')
{
$structure = true;
}
if ($type == 'full' || $type == 'data')
{
$schema_data = true;
}
@set_time_limit(1200); @set_time_limit(1200);
@set_time_limit(0); @set_time_limit(0);
@ -92,14 +78,14 @@ class acp_database
/** @var phpbb\db\extractor\extractor_interface $extractor Database extractor */ /** @var phpbb\db\extractor\extractor_interface $extractor Database extractor */
$extractor = $phpbb_container->get('dbal.extractor'); $extractor = $phpbb_container->get('dbal.extractor');
$extractor->init_extractor($format, $filename, $time, false, $store); $extractor->init_extractor($format, $filename, $time, false, true);
$extractor->write_start($table_prefix); $extractor->write_start($table_prefix);
foreach ($table as $table_name) foreach ($table as $table_name)
{ {
// Get the table structure // Get the table structure
if ($structure) if ($type == 'full')
{ {
$extractor->write_table($table_name); $extractor->write_table($table_name);
} }
@ -123,16 +109,12 @@ class acp_database
default: default:
$extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n"); $extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n");
break;
} }
} }
// Data // Only supported types are full and data, therefore always write the data
if ($schema_data)
{
$extractor->write_data($table_name); $extractor->write_data($table_name);
} }
}
$extractor->write_end(); $extractor->write_end();

View file

@ -70,7 +70,6 @@ $lang = array_merge($lang, array(
'START_RESTORE' => 'Start restore', 'START_RESTORE' => 'Start restore',
'STORE_AND_DOWNLOAD' => 'Store and download', 'STORE_AND_DOWNLOAD' => 'Store and download',
'STORE_LOCAL' => 'Store file locally', 'STORE_LOCAL' => 'Store file locally',
'STRUCTURE_ONLY' => 'Structure only',
'TABLE_SELECT' => 'Table select', 'TABLE_SELECT' => 'Table select',
'TABLE_SELECT_ERROR'=> 'You must select at least one table.', 'TABLE_SELECT_ERROR'=> 'You must select at least one table.',