From 2274d665c87ff32d27fad49f90ec9533efdc9e2f Mon Sep 17 00:00:00 2001 From: Theo Weijmer Date: Wed, 2 Jan 2019 17:28:07 +0100 Subject: [PATCH] backup onder beheer --- application/controllers/utils/DownloadDB.php | 41 +++++++++++++++++++ application/views/pages/backupdb_view.php | 0 application/views/partials/_js.php | 1 + .../js/lib/modules/beheer/backupdbModule.js | 11 +++++ 4 files changed, 53 insertions(+) create mode 100644 application/controllers/utils/DownloadDB.php create mode 100644 application/views/pages/backupdb_view.php create mode 100644 public/js/lib/modules/beheer/backupdbModule.js diff --git a/application/controllers/utils/DownloadDB.php b/application/controllers/utils/DownloadDB.php new file mode 100644 index 0000000..cfce956 --- /dev/null +++ b/application/controllers/utils/DownloadDB.php @@ -0,0 +1,41 @@ +load->dbutil(); + + $filename = "backupDBOIS_" . date( 'YmdHis' ); + + $prefs = [ + 'tables' => [], // Array of tables to backup. + 'ignore' => [], // List of tables to omit from the backup + 'format' => '', // gzip, zip, txt + 'filename' => NULL, // File name - NEEDED ONLY WITH ZIP FILES + 'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file + 'add_insert' => TRUE, // Whether to add INSERT data to backup file + 'newline' => "\n" // Newline character used in backup file + ]; + + $backup = $this->dbutil->backup( $prefs ); + +// Load the download helper and send the file to your desktop + $this->load->helper( 'download' ); + force_download( $filename . '.sql', $backup ); + } + +} \ No newline at end of file diff --git a/application/views/pages/backupdb_view.php b/application/views/pages/backupdb_view.php new file mode 100644 index 0000000..e69de29 diff --git a/application/views/partials/_js.php b/application/views/partials/_js.php index 7a6d4a9..1841df7 100644 --- a/application/views/partials/_js.php +++ b/application/views/partials/_js.php @@ -45,6 +45,7 @@ + diff --git a/public/js/lib/modules/beheer/backupdbModule.js b/public/js/lib/modules/beheer/backupdbModule.js new file mode 100644 index 0000000..5dee91e --- /dev/null +++ b/public/js/lib/modules/beheer/backupdbModule.js @@ -0,0 +1,11 @@ +/** + * Created by Pensare Software. + * User: Theo Weijmer + * Date: 2019-01-02 + * Time: 17:09 + */ + +dbo.backupdbInit = function(){ + + window.open( 'index.php/utils/downloaddb' ); +} \ No newline at end of file