/** * FUnction to back up the existing wordpress installation files **/ function wpau_backup_files($automated = false) { if (!current_user_can('edit_files')) { echo 'Oops sorry you are not authorized to do this'; return false; } global $wpauDirPath, $wpAbsPath, $theFuncComplete, $isNix, $wpIncludeDirs; $wpauHelper = new wpauHelper(); $dirName = trailingslashit(ABSPATH); $dirName = $dirName . WPAU_BACKUP_DIR; $dirName = trailingslashit($dirName); if (!is_dir($dirName)) { mkdir($dirName); chmod($dirName, 0757); $wpauHelper->createIndexes(); } else { $wpauHelper->createIndexes(); @chmod($dirName, 0757); } wpauPersistNoLog(false, false, $automated); $message = ''; require_once 'wpau_zip.class.php'; $extension = '.zip'; $zipFuncs = new wpauZipFuncs($wpAbsPath, $isNix, WPAU_FILES_ZIP, WPAU_BACKUP_DIR, $wpIncludeDirs, $extension); $zipFuncs->createArchive(); if ($zipFuncs->isFileWritten) { $message = '<br />The files been have been succesfully backed up. <a href="' . get_bloginfo('wpurl') . '/' . WPAU_BACKUP_DIR . '/' . $_SESSION['filesbakname'] . '">DOWNLOAD IT</a> BEFORE YOU CAN GO AHEAD. <br/>CONTINUE ONLY after verifying that the files have been downloaded<br />'; $theFuncComplete = true; } else { $message = 'The files could not be backed up, cannot continue with the operation'; $theFuncComplete = false; } wpauPersist(true, $zipFuncs->loggedData, $theFuncComplete, $message, true); unset($zipFuncs); unset($wpauHelper); if ($automated) { return $theFuncComplete; } }