/** 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; } }
/** * Function to show the log for the upgrade **/ function wpau_show_backup_log($automated = false) { global $wpdb; $logData = ''; wpauStartHtml(); echo '<strong>Congratulations!!! Your Wordpresss installation has been upgraded.</strong>'; echo '<br /><strong>Please download your backup files if you have not done it.</strong><br />'; echo '<a href="'.get_bloginfo('siteurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['filesbakname'].'">DOWNLOAD FILES BACKUP</a><br />'; echo '<a href="'.get_bloginfo('siteurl').'/'.WPAU_BACKUP_DIR.'/'.$_SESSION['dbbakname'].'">DOWNLOAD DATABASE BACKUP</a><br />'; echo 'Don\'t forget to run <a href="'.get_bloginfo('siteurl').'/wp-admin/upgrade.php" target="_blank">Database Upgrade</a> if you have not done it.'; echo 'You can <a href="?page='.WPAU_PAGE.'&task=cleanup">Clean up</a> the ugradation files once your done'; echo "<hr /><strong>Below is the log for the upgradation</strong><br /><hr />"; $logData = getDBLog(); $wpauHelper = new wpauHelper; $dirName = trailingslashit(ABSPATH); $dirName = trailingslashit($dirName); if($wpauHelper->writeLogToDisk($dirName, WPAU_LOG_FILE, $logData)) { echo '<strong>Click <a href="'.get_bloginfo('siteurl').'/'.WPAU_LOG_FILE.'" target="_blank">here</a> to download the log file</strong><br>'; } unset($wpauHelper); echo $logData; wpauEndHtml(); }