From f7a4490c1374a478af2f54d9d733d358ca4f2866 Mon Sep 17 00:00:00 2001 From: Banana Date: Wed, 1 Jan 2020 18:54:12 +0100 Subject: [PATCH] DB export only the insipid tables and not the whole DB --- ChangeLog | 1 + TODO | 1 - webroot/lib/Mysqldump.php | 3 ++- webroot/view/stats.inc.php | 24 +++++++++++++++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b81e2a1..5c5d475 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ version x.x - Seven Portals (tba) + Now including update instructions + + DB export only insipid tables and not the whole DB itself. + Fixed the search for words. See update instructions how to correct your data version 2.3 - Guardian of Steel (2019-12-30) diff --git a/TODO b/TODO index 4e6aa64..2fcf6c4 100755 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ TODO / Feature list + Export and import of your data -+ DB backup on the tables used in insipid and not whole db + snapshots + bookmark js snippet + theme support diff --git a/webroot/lib/Mysqldump.php b/webroot/lib/Mysqldump.php index 06d3ff7..ed9fde5 100644 --- a/webroot/lib/Mysqldump.php +++ b/webroot/lib/Mysqldump.php @@ -160,6 +160,7 @@ class Mysqldump 'skip-dump-date' => false, 'skip-definer' => false, 'where' => '', + 'include-views' => array(), /* deprecated */ 'disable-foreign-keys-check' => true ); @@ -197,7 +198,7 @@ class Mysqldump } // Dump the same views as tables, mimic mysqldump behaviour - $this->dumpSettings['include-views'] = $this->dumpSettings['include-tables']; + //$this->dumpSettings['include-views'] = $this->dumpSettings['include-tables']; // Create a new compressManager to manage compressed output $this->compressManager = CompressManagerFactory::create($this->dumpSettings['compress']); diff --git a/webroot/view/stats.inc.php b/webroot/view/stats.inc.php index c8bfd22..16cdb31 100644 --- a/webroot/view/stats.inc.php +++ b/webroot/view/stats.inc.php @@ -46,7 +46,29 @@ if(isset($_POST['statsCreateDBBackup'])) { require_once 'lib/Mysqldump.php'; $backupTmpFile = tempnam(sys_get_temp_dir(),'inspid'); - $dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USERNAME, DB_PASSWORD); + // mysqldump was modifed to make this work + // include-views was not working while using include-tables + $dumpSettings = array( + 'include-tables' => array( + DB_PREFIX.'_category', + DB_PREFIX.'_categoryrelation', + DB_PREFIX.'_link', + DB_PREFIX.'_tag', + DB_PREFIX.'_tagrelation' + ), + 'include-views' => array( + DB_PREFIX.'_combined' + ), + 'default-character-set' => \Ifsnop\Mysqldump\Mysqldump::UTF8MB4 + ); + $dump = new Ifsnop\Mysqldump\Mysqldump( + 'mysql:host='.DB_HOST.';dbname='.DB_NAME, + DB_USERNAME, + DB_PASSWORD, + $dumpSettings + ); + + $dump->start($backupTmpFile); header('Content-Type: application/octet-stream'); -- 2.39.5