/** Backs up the database tables and saves it to a file Taken from the plugin Wordpress Database backup created byAustin Matzko. **/ function wpau_backup_db($automated = false) { if (!current_user_can('manage_options')) { echo 'Oops sorry you are not authorized to do this'; return false; } global $wpAbsPath, $isNix, $theFuncComplete; wpauPersistNoLog(false, false, $automated); $backupDir = WPAU_BACKUP_DIR; $wpauHelper = new wpauHelper(); $backupFile = WPAU_DB_ZIP . $wpauHelper->random() . '.zip'; $_SESSION['dbbakname'] = $backupFile; unset($wpauHelper); require_once 'wpau_db_backup.class.php'; $wpauDbBackup = new wpauBackup($backupDir); if ($wpauDbBackup->perform_backup($automated)) { if ($wpauDbBackup->zip_backup($backupFile)) { $theFuncComplete = true; $message = 'The database has been succesfully backed up. <a href="' . get_bloginfo('wpurl') . '/' . WPAU_BACKUP_DIR . '/' . $_SESSION['dbbakname'] . '">DOWNLOAD IT</a> BEFORE YOU CAN GO AHEAD. <br/>CONTINUE ONLY after verifying that the files have been downloaded<br />'; } else { $theFuncComplete = false; $message = 'Could not backup your database files, cannot continue with the further process'; } } else { $theFuncComplete = false; $message = 'Could not backup your database files, cannot continue with the further process'; } wpauPersist(true, $wpauDbBackup->loggedData, $theFuncComplete, $message, true); unset($wpauDbBackup); if ($automated) { return $theFuncComplete; } }