From acf08859483a609752b2c15a904ac69b35e87ea5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 25 May 2021 20:34:31 +0200 Subject: [PATCH] [ticket/16783] Add back data only backups PHPBB3-16783 --- phpBB/adm/style/acp_database.html | 5 +++++ phpBB/includes/acp/acp_database.php | 30 +++++++++++++++++++++++++++-- phpBB/language/en/acp/database.php | 1 - 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_database.html b/phpBB/adm/style/acp_database.html index 26bc563e5b..b0b7c54dbb 100644 --- a/phpBB/adm/style/acp_database.html +++ b/phpBB/adm/style/acp_database.html @@ -55,6 +55,11 @@
{L_BACKUP_OPTIONS} +
+
+
+
+
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 6d96d5bf8e..e320df2117 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -55,6 +55,7 @@ class acp_database switch ($action) { case 'download': + $type = $request->variable('type', ''); $table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); $format = $request->variable('method', ''); @@ -84,9 +85,34 @@ class acp_database foreach ($table as $table_name) { // Get the table structure - $extractor->write_table($table_name); + if ($type == 'full') + { + $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; - // Data + 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"); + } + } + + // Only supported types are full and data, therefore always write the data $extractor->write_data($table_name); } diff --git a/phpBB/language/en/acp/database.php b/phpBB/language/en/acp/database.php index 302aaee570..11acfe82d3 100644 --- a/phpBB/language/en/acp/database.php +++ b/phpBB/language/en/acp/database.php @@ -70,7 +70,6 @@ $lang = array_merge($lang, array( 'START_RESTORE' => 'Start restore', 'STORE_AND_DOWNLOAD' => 'Store and download', 'STORE_LOCAL' => 'Store file locally', - 'STRUCTURE_ONLY' => 'Structure only', 'TABLE_SELECT' => 'Table select', 'TABLE_SELECT_ERROR'=> 'You must select at least one table.',