has_cap('manage_database')) { $role->add_cap('manage_database'); } } ### Function: Download Database add_action('init', 'download_database'); function download_database() { if($_POST['do'] == 'Download' && !empty($_POST['database_file'])) { if(strpos($_SERVER['HTTP_REFERER'], get_settings('siteurl').'/wp-admin/admin.php?page=dbmanager/database-manage.php') !== false) { $backup_options = get_settings('dbmanager_options'); $file_path = $backup_options['path'].'/'.$_POST['database_file']; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=".basename($file_path).";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($file_path)); @readfile($file_path); } exit(); } } ### Function: Database Options function dbmanager_options() { global $wpdb; $text = ''; $backup_options = array(); $backup_options = get_settings('dbmanager_options'); if($_POST['Submit']) { $backup_options['mysqldumppath'] = trim($_POST['db_mysqldumppath']); $backup_options['mysqlpath'] = trim($_POST['db_mysqlpath']); $backup_options['path'] = trim($_POST['db_path']); $update_db_options = update_option('dbmanager_options', $backup_options); if($update_db_options) { $text = ''.__('DB Options Updated').''; } if(empty($text)) { $text = ''.__('No DB Option Updated').''; } } ?>
'.$text.'
Windows Server
For mysqldump path, you can try 'mysqldump.exe'.
For mysql path, you can try 'mysql.exe'.
Linux Server
For mysqldump path, normally is just 'mysqldump'.
For mysql path, normally is just 'mysql'.