/** METHOD: ResetHTACCESS * Resets the .htaccess file */ public static function Setup() { if (!isset($_POST['url_new'])) { return; } DUPX_Log::Info("\nWEB SERVER CONFIGURATION FILE BASIC SETUP:"); $currdata = parse_url($_POST['url_old']); $newdata = parse_url($_POST['url_new']); $currpath = DUPX_Util::add_slash(isset($currdata['path']) ? $currdata['path'] : ""); $newpath = DUPX_Util::add_slash(isset($newdata['path']) ? $newdata['path'] : ""); $tmp_htaccess = <<<HTACCESS # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase {$newpath} RewriteRule ^index\\.php\$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . {$newpath}index.php [L] </IfModule> # END WordPress HTACCESS; file_put_contents('.htaccess', $tmp_htaccess); @chmod('.htaccess', 0644); DUPX_Log::Info("created basic .htaccess file. If using IIS web.config this process will need to be done manually."); }
<?php // Exit if accessed directly if (!defined('DUPLICATOR_INIT')) { $_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; header("HTTP/1.1 301 Moved Permanently"); header("Location: {$_baseURL}"); exit; } $dbh = DUPX_Util::db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'], $_POST['dbport']); $all_tables = DUPX_Util::get_database_tables($dbh); $active_plugins = DUPX_Util::get_active_plugins($dbh); $old_path = $GLOBALS['FW_WPROOT']; $new_path = DUPX_Util::set_safe_path($GLOBALS['CURRENT_ROOT_PATH']); $new_path = strrpos($old_path, '/') + 1 == strlen($old_path) ? DUPX_Util::add_slash($new_path) : $new_path; ?> <script type="text/javascript"> /** ********************************************** * METHOD: * Timeout (10000000 = 166 minutes) */ Duplicator.runUpdate = function() { //Validation var wp_username = $.trim($("#wp_username").val()).length || 0; var wp_password = $.trim($("#wp_password").val()).length || 0; if ( $.trim($("#url_new").val()) == "" ) {alert("The 'New URL' field is required!"); return false;} if ( $.trim($("#siteurl").val()) == "" ) {alert("The 'Site URL' field is required!"); return false;} if (wp_username >= 1 && wp_username < 4) {alert("The New Admin Account 'Username' must be four or more characters"); return false;} if (wp_username >= 4 && wp_password < 6) {alert("The New Admin Account 'Password' must be six or more characters"); return false;}