[ticket/16783] Remove structure only backup

PHPBB3-16783
This commit is contained in:
Marc Alexander 2021-05-24 16:36:54 +02:00
parent 8a746b457d
commit d8ef094a9a
No known key found for this signature in database
GPG key ID: 50E0D2423696F995
2 changed files with 3 additions and 53 deletions

View file

@ -55,12 +55,6 @@
<fieldset> <fieldset>
<legend>{L_BACKUP_OPTIONS}</legend> <legend>{L_BACKUP_OPTIONS}</legend>
<dl>
<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>
<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>
</dl>
<dl> <dl>
<dt><label for="method">{L_FILE_TYPE}{L_COLON}</label></dt> <dt><label for="method">{L_FILE_TYPE}{L_COLON}</label></dt>
<dd><!-- BEGIN methods --> <dd><!-- BEGIN methods -->

View file

@ -55,7 +55,6 @@ class acp_database
switch ($action) switch ($action)
{ {
case 'download': case 'download':
$type = $request->variable('type', '');
$table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); $table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array('')));
$format = $request->variable('method', ''); $format = $request->variable('method', '');
@ -69,20 +68,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,46 +77,17 @@ 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) $extractor->write_table($table_name);
{
$extractor->write_table($table_name);
}
else
{
// We might wanna empty out all that junk :D
switch ($db->get_sql_layer())
{
case 'sqlite3':
$extractor->flush('DELETE FROM ' . $table_name . ";\n");
break;
case 'mssql_odbc':
case 'mssqlnative':
$extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n");
break;
case 'oracle':
$extractor->flush('TRUNCATE TABLE ' . $table_name . "/\n");
break;
default:
$extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n");
break;
}
}
// Data // Data
if ($schema_data) $extractor->write_data($table_name);
{
$extractor->write_data($table_name);
}
} }
$extractor->write_end(); $extractor->write_end();