/**
  *  Backup database and init download.
  */
 function backUpDatabase()
 {
     include $_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . "library/mysql.export.class.php";
     $conf = DbConfig::getConf();
     $e = new export_mysql($conf['host'], $conf['user'], $conf['pass'], $conf['db']);
     $fname = $_SERVER['DOCUMENT_ROOT'] . $_SERVER['APP_ROOT'] . 'docs/backup/dbbackup-' . date("Y-m-d_H-i-s") . '.sql';
     $e->exportValue($fname, false);
     header('Content-Description: File Transfer');
     header('Content-Type: application/octet-stream');
     header('Content-Disposition: attachment; filename="' . basename($fname) . '"');
     //<<< Note the " " surrounding the file name
     header('Content-Transfer-Encoding: binary');
     header('Connection: Keep-Alive');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Content-Length: ' . filesize($fname));
     echo file_get_contents($fname);
     // unlink($fname); TODO: Option to keep on server
     // log data
     Logger::write("Database backed up", "UTIL");
 }