backup onder beheer
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by Pensare Software.
|
||||
* User: Theo Weijmer
|
||||
* Date: 2019-01-02
|
||||
* Time: 17:13
|
||||
*/
|
||||
|
||||
class DownloadDB extends MY_Controller {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
if ( AUTHENTICATED == FALSE ) die( 'NO ACCESS' );
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$this->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 );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user