]> 91.132.146.200 Git - insipid.git/commitdiff
DB export only the insipid tables and not the whole DB
authorBanana <banana@mirage>
Wed, 1 Jan 2020 17:54:12 +0000 (18:54 +0100)
committerBanana <banana@mirage>
Wed, 1 Jan 2020 17:54:12 +0000 (18:54 +0100)
ChangeLog
TODO
webroot/lib/Mysqldump.php
webroot/view/stats.inc.php

index b81e2a184254c8499f31d37b323de00512772576..5c5d475c992081a9c4d1af79432a1c7c333b948e 100755 (executable)
--- 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 4e6aa64a6e8f0d361817c27a84ff0f9189508d61..2fcf6c42cc41376d9d15bdd2e9cae94886b18d35 100755 (executable)
--- 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
index 06d3ff71de4fa99acae0bf931cb421ea93fd527c..ed9fde5d4a64f9b56e536dcb815ea8a73415110d 100644 (file)
@@ -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']);
index c8bfd228eef3f4803503df88f9cc8bebc5d76feb..16cdb31e2f1b5d209c8635e0fd1f006f0778e96a 100644 (file)
@@ -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');