- get_admin_options();
-
- // Apply filters to the given domain names
- $old_domain_name = esc_url_raw( $_POST['old_domain_name'] );
- $new_domain_name = esc_url_raw( $_POST['new_domain_name'] );
-
- // Create a backup of the database in case the operation fails
- $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
-
- // Create a backup of the database by changing instances of the old domain name with the newer one
- $new_db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'], count( $db_backups ) + 1, $old_domain_name, $new_domain_name );
-
- // Set error counter to zero
- $errors_occured = 0;
-
- // Import databsae backups we've just created
- foreach ( $new_db_backups as $backup )
- if ( TRUE !== wpmove_import_db_backup( $backup ) )
- $errors_occured++;
-
- // If everything went well...
- if ( ! $errors_occured ) {
-
- // Move the backup files we created "just in case" to the old backup directory
- foreach ( $db_backups as $backup )
- rename( trailingslashit( WPMOVE_BACKUP_DIR ) . $backup, trailingslashit( WPMOVE_OLD_BACKUP_DIR ) . $backup );
-
- // Remove the backup files we've just imported as we won't need them anymore
- foreach ( $new_db_backups as $backup )
- wpmove_remove_db_backup( $backup );
-
- // Prepare the new homepage URL
- $new_home_url = str_replace( $old_domain_name, $new_domain_name, home_url( '/' ) );
-
- // Display a success message
- ?>
-
-
-
-
-
-
-
- Click here to go to your site using your new domain.', 'WPMove' ), $new_home_url ); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- get_admin_options();
-
- // If the FTP details are not on file, redirect the user to the settings page
- if ( $wpmove_options['ftp_hostname'] == '' || $wpmove_options['ftp_username'] == '' || $wpmove_options['ftp_port'] == 0 ) {
- echo '';
- }
-
- if ( $_POST && check_admin_referer( 'wpmove_advanced_migration_start' ) ) {
-
- ?>
-
-
-
-
-
-
- get_admin_options();
-
- // Create an array to hold backup files that will be uploaded
- $backups = array();
-
- // If changing the current domain name is also requested...
- if ( ! empty( $_POST['old_domain_name'] ) && ! empty( $_POST['new_domain_name'] ) ) {
-
- // Apply filters to the given domain names
- $old_domain_name = esc_url_raw( $_POST['old_domain_name'] );
- $new_domain_name = esc_url_raw( $_POST['new_domain_name'] );
-
- // Create a backup of the database by changing instances of the old domain name with the newer one
- $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'], 1, $old_domain_name, $new_domain_name );
-
- } else {
-
- // Create a backup of the database
- $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
-
- }
-
- // Add names of database backup files to the array of backup files
- $backups = array_merge( $backups, $db_backups );
-
- // Check whether an array is actually posted or not
- if ( isset( $_POST['files'] ) && is_array( $_POST['files'] ) ) {
-
- // Use the POST data directly, if the fallback method is being used
- $files = array_map( 'sanitize_text_field', $_POST['files'] );
-
- // Remove non-empty directories from the array
- $files = array_filter( $files );
-
- // Create chunks from the selected files
- $chunks = wpmove_divide_into_chunks( $files, $wpmove_options['fs_chunk_size'] );
-
- // To prevent overwriting archives created in the same second
- $chunk_id = 1;
-
- // Create an archive of the each chunk
- foreach ( $chunks as $chunk )
- array_push( $backups, wpmove_create_archive( $chunk, ABSPATH, $chunk_id++ ) );
- }
-
- // Check whether creating backups files succeeded or not
- if ( ! file_exists( trailingslashit( WPMOVE_BACKUP_DIR ) . $backups['0'] ) ) {
- _e( 'Could not create backup files. Please make sure the backup directory is writable. For further info, please refer to the documentation.', 'WPMove' );
- } else {
-
- // Upload files and display a success message on success
- if ( $this->upload_files( $backups, sanitize_text_field( $_POST['ftp_password'] ) ) ) {
-
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ' . __( 'Loading...', 'WPMove' ) . ''; ?>
-
-
-
- get_admin_options();
-
- // Instantiate the FTP class
- $ftp = new ftp();
-
- // Enter Passive Mode if enabled
- if ( $wpmove_options['ftp_passive_mode'] )
- $ftp->Passive( TRUE );
-
- echo '';
-
- printf( __( 'Connecting to %s:%d...', 'WPMove' ), $wpmove_options['ftp_hostname'], $wpmove_options['ftp_port'] );
- $this->flush_output();
-
- // Set the hostname and the port
- $ftp->SetServer( $wpmove_options['ftp_hostname'], intval( $wpmove_options['ftp_port'] ) );
-
- // Try connecting to the server
- if ( $ftp->connect() ) {
-
- echo ' ' . __( 'Success!', 'WPMove' ) . ' ';
- $this->flush_output();
-
- // Display a different message if no password is given
- if ( '' !== $ftp_password )
- printf( __( 'Logging in as %s using password...', 'WPMove' ), $wpmove_options['ftp_username'] );
- else
- printf( __( 'Logging in as %s without a password...', 'WPMove' ), $wpmove_options['ftp_username'] );
-
- $this->flush_output();
-
- // Login to the server using the supplied credentials
- if ( $ftp->login( $wpmove_options['ftp_username'], $ftp_password ) ) {
-
- echo ' ' . __( 'Success!', 'WPMove' ) . ' ' . __( 'Starting uploading files...', 'WPMove' ) . ' ';
-
- $this->flush_output();
-
- // Changes the present working directory to the backup directory on the remote server
- $ftp->chdir( $wpmove_options['ftp_remote_path'] );
-
- // Start counting errors during the file upload
- $error_count = 0;
-
- // Upload the given backup files under the backup folder to the server
- foreach ( $files as $file ) {
- printf( __( '%s is being uploaded...', 'WPMove' ), basename( $file ) );
- $this->flush_output();
- if ( FALSE !== ( $ftp->put( trailingslashit( WPMOVE_BACKUP_DIR ) . $file, basename( $file ) ) ) ) {
- echo '' . __( ' Success!', 'WPMove' ) . ' ';
- } else {
- echo '' . __( ' Failed!', 'WPMove' ) . ' ';
- $error_count++;
- }
- $this->flush_output();
- }
-
- // Notify the user about the errors occured
- if ( $error_count )
- printf( _n( 'Uploading files is completed with %d error...', 'Uploading files is completed with %d errors...', $error_count, 'WPMove' ), $error_count );
- else
- _e( 'Uploading files is completed without an error...', 'WPMove' );
-
- $this->flush_output();
-
- echo ' ';
- _e( 'Closing the FTP connection...', 'WPMove' );
- echo ' ';
-
- // Close the connection
- $ftp->quit();
-
- // Return TRUE on success
- return TRUE;
- }
-
- // Close the connection
- $ftp->quit();
- }
-
- echo ' ' . __( ' Failed!', 'WPMove' ) . ' ' . __( 'Operation terminated...', 'WPMove' ) . ' ';
-
- // If it reaches here, apparently it failed
- return FALSE;
- }
-
- /**
- * Handles the migration completing process.
- *
- * @param void
- * @return void
- */
- function print_complete_migration_page() {
-
- // If the user clicks the proceed link...
- if ( $_POST && check_admin_referer( 'wpmove_complete_migration_start' ) ) {
-
- ?>
-
-
-
-
-
-
- ';
- printf( __( '%s is being imported...', 'WPMove' ), basename( $file ) );
-
- $this->flush_output();
-
- echo ' ';
-
- if ( wpmove_import_db_backup( basename( $file ) ) ) {
- _e( 'Success!', 'WPMove' );
- } else {
- $errors_occured++;
- _e( 'Failed!', 'WPMove' );
- if ( ! is_readable( $file ) )
- echo ' ' . __( 'Check file permissions...', 'WPMove' );
- }
-
- echo ' ';
-
- } else if ( 'zip' == $ext ) {
-
- echo '';
- printf( __( '%s is being extracted...', 'WPMove' ), basename( $file ) );
-
- $this->flush_output();
-
- echo ' ';
-
- if ( wpmove_extract_archive( basename( $file ), ABSPATH ) ) {
- _e( 'Success!', 'WPMove' );
- } else {
- $errors_occured++;
- _e( 'Failed!', 'WPMove' );
- if ( ! is_readable( $file ) )
- echo ' ' . __( 'Check file permissions...', 'WPMove' );
- }
-
- echo ' ';
- }
- }
- }
-
- // If there were errors, notify the user
- if ( ! isset( $errors_occured ) )
- _e( 'Please select files to migrate before proceeding!', 'WPMove' );
- else {
- echo ' ';
- if ( $errors_occured > 0 )
- printf( _n( 'Migration has been completed but with %d error.', 'Migration has been completed but with %d errors.', $errors_occured, 'WPMove' ), $errors_occured );
- else
- _e( 'Migration has been completed successfully!', 'WPMove' );
- }
-
- ?>
-
-
-
-
-
-
-
-
- 1 ) {
-
- ?>
-
-
-
-
-
- get_admin_options();
-
- // An array to hold backup files that will be uploaded
- $backups = array();
-
- // Create a backup of the database
- wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
-
- if ( isset( $_POST['wpmove_create_full_backup'] ) ) {
-
- // List all of the files inside the main directory
- $abspath = substr( ABSPATH, 0, strlen( ABSPATH ) - 1 );
- $files = wpmove_list_all_files( $abspath, FALSE, array( WPMOVE_DIR, WPMOVE_BACKUP_DIR, WPMOVE_OLD_BACKUP_DIR ) );
-
- // Create chunks from the selected files
- $chunks = wpmove_divide_into_chunks( $files, $wpmove_options['fs_chunk_size'] );
-
- // To prevent overwriting archives created in the same second
- $chunk_id = 1;
-
- // Create an archive of the each chunk
- foreach ( $chunks as $chunk )
- wpmove_create_archive( $chunk, ABSPATH, $chunk_id++ );
-
- }
-
- }
-
- ?>
-
+ get_admin_options();
+
+ // Apply filters to the given domain names
+ $old_domain_name = esc_url_raw( $_POST['old_domain_name'] );
+ $new_domain_name = esc_url_raw( $_POST['new_domain_name'] );
+
+ // Create a backup of the database in case the operation fails
+ $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
+
+ // Create a backup of the database by changing instances of the old domain name with the newer one
+ $new_db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'], count( $db_backups ) + 1, $old_domain_name, $new_domain_name );
+
+ // Set error counter to zero
+ $errors_occured = 0;
+
+ // Import databsae backups we've just created
+ foreach ( $new_db_backups as $backup )
+ if ( TRUE !== wpmove_import_db_backup( $backup ) )
+ $errors_occured++;
+
+ // If everything went well...
+ if ( ! $errors_occured ) {
+
+ // Move the backup files we created "just in case" to the old backup directory
+ foreach ( $db_backups as $backup )
+ rename( trailingslashit( WPMOVE_BACKUP_DIR ) . $backup, trailingslashit( WPMOVE_OLD_BACKUP_DIR ) . $backup );
+
+ // Remove the backup files we've just imported as we won't need them anymore
+ foreach ( $new_db_backups as $backup )
+ wpmove_remove_db_backup( $backup );
+
+ // Prepare the new homepage URL
+ $new_home_url = str_replace( $old_domain_name, $new_domain_name, home_url( '/' ) );
+
+ // Display a success message
+ ?>
+
+
+
+
+
+
+
+ Click here to go to your site using your new domain.', 'WPMove' ), $new_home_url ); ?>
+
+ get_admin_options();
+
+ // If the FTP details are not on file, redirect the user to the settings page
+ //if ( $wpmove_options['ftp_dev_hostname'] == '' || $wpmove_options['ftp_dev_username'] == '' || $wpmove_options['ftp__dev_port'] == 0 ) {
+ // echo '';
+ //}
+
+ if ( $_POST && check_admin_referer( 'wpmove_advanced_migration_start' ) ) {
+
+ ?>
+
+
+
+
+
+
+ get_admin_options();
+
+ // Create an array to hold backup files that will be uploaded
+ $backups = array();
+
+ // If changing the current domain name is also requested...
+ if ( ! empty( $_POST['old_domain_name'] ) && ! empty( $_POST['new_domain_name'] ) ) {
+
+ // Apply filters to the given domain names
+ $old_domain_name = esc_url_raw( $_POST['old_domain_name'] );
+ $new_domain_name = esc_url_raw( $_POST['new_domain_name'] );
+
+ // Create a backup of the database by changing instances of the old domain name with the newer one
+ $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'], 1, $old_domain_name, $new_domain_name );
+
+ } else {
+
+ // Create a backup of the database
+ $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
+
+ }
+
+ // Add names of database backup files to the array of backup files
+ $backups = array_merge( $backups, $db_backups );
+
+ // Check whether an array is actually posted or not
+ if ( isset( $_POST['files'] ) && is_array( $_POST['files'] ) ) {
+
+ // Use the POST data directly, if the fallback method is being used
+ $files = array_map( 'sanitize_text_field', $_POST['files'] );
+
+ // Remove non-empty directories from the array
+ $files = array_filter( $files );
+
+ // Create chunks from the selected files
+ $chunks = wpmove_divide_into_chunks( $files, $wpmove_options['fs_chunk_size'] );
+
+ // To prevent overwriting archives created in the same second
+ $chunk_id = 1;
+
+ // Create an archive of the each chunk
+ foreach ( $chunks as $chunk )
+ array_push( $backups, wpmove_create_archive( $chunk, ABSPATH, $chunk_id++ ) );
+ }
+
+ // Check whether creating backups files succeeded or not
+ if ( ! file_exists( trailingslashit( WPMOVE_BACKUP_DIR ) . $backups['0'] ) ) {
+ _e( 'Could not create backup files. Please make sure the backup directory is writable. For further info, please refer to the documentation.', 'WPMove' );
+ } else {
+
+ // Upload files and display a success message on success
+ if ( $this->upload_files( $backups, sanitize_text_field( $_POST['ftp_password'] ) ) ) {
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ get_admin_options();
+
+ $server= sanitize_text_field($_GET['server']);
+
+ $ftp_password = $wpmove_options['ftp_'.$server.'_password'];
+
+
+ // Create an array to hold backup files that will be uploaded
+ $backups = array();
+
+ // Apply filters to the given domain names
+ $old_domain_name = home_url();
+ $new_domain_name = $wpmove_options['ftp_'.$server.'_url'];
+
+ // Create a backup of the database by changing instances of the old domain name with the newer one
+ $db_backups = wpmove_create_db_backup( $wpmove_options['db_chunk_size'], 1, $old_domain_name, $new_domain_name );
+
+
+ // Add names of database backup files to the array of backup files
+ $backups = array_merge( $backups, $db_backups );
+
+ // Check whether an array is actually posted or not
+ if ( isset( $_POST['files'] ) && is_array( $_POST['files'] ) ) {
+
+ // Use the POST data directly, if the fallback method is being used
+ $files = array_map( 'sanitize_text_field', $_POST['files'] );
+
+ // Remove non-empty directories from the array
+ $files = array_filter( $files );
+
+ // Create chunks from the selected files
+ $chunks = wpmove_divide_into_chunks( $files, $wpmove_options['fs_chunk_size'] );
+
+ // To prevent overwriting archives created in the same second
+ $chunk_id = 1;
+
+ // Create an archive of the each chunk
+ foreach ( $chunks as $chunk )
+ array_push( $backups, wpmove_create_archive( $chunk, ABSPATH, $chunk_id++ ) );
+ }
+
+ // Check whether creating backups files succeeded or not
+ if ( ! file_exists( trailingslashit( WPMOVE_BACKUP_DIR ) . $backups['0'] ) ) {
+ _e( 'Could not create backup files. Please make sure the backup directory is writable. For further info, please refer to the documentation.', 'WPMove' );
+ } else {
+
+ // Upload files and display a success message on success
+ if ( $this->upload_files( $backups, sanitize_text_field( $ftp_password ) ) ) {
+
+ ?>
+
+ The database has been uploaded to '.$server.'. Log in to '.$server.' to complete migration.', 'WPMove' ); ?>
+
+
+
+
+
+
+
+ get_admin_options();
+ $server= sanitize_text_field($_GET['server']);
+ ?>
+
+ get_admin_options();
+
+ // Instantiate the FTP class
+ $ftp = new ftp();
+
+ // Enter Passive Mode if enabled
+ if ( $wpmove_options['ftp_'.$server.'_passive_mode'] )
+ $ftp->Passive( TRUE );
+
+ echo '';
+
+ printf( __( 'Connecting to %s:%d...', 'WPMove' ), $wpmove_options['ftp_'.$server.'_hostname'], $wpmove_options['ftp_'.$server.'_port'] );
+ $this->flush_output();
+
+ // Set the hostname and the port
+ $ftp->SetServer( $wpmove_options['ftp_'.$server.'_hostname'], intval( $wpmove_options['ftp_'.$server.'_port'] ) );
+
+ // Try connecting to the server
+ if ( $ftp->connect() ) {
+
+ echo ' ' . __( 'Success!', 'WPMove' ) . ' ';
+ $this->flush_output();
+
+ // Display a different message if no password is given
+ if ( '' !== $ftp_password )
+ printf( __( 'Logging in as %s using password...', 'WPMove' ), $wpmove_options['ftp_'.$server.'_username'] );
+ else
+ printf( __( 'Logging in as %s without a password...', 'WPMove' ), $wpmove_options['ftp_'.$server.'_username'] );
+
+ $this->flush_output();
+
+ // Login to the server using the supplied credentials
+ if ( $ftp->login( $wpmove_options['ftp_'.$server.'_username'], $ftp_password ) ) {
+
+ echo ' ' . __( 'Success!', 'WPMove' ) . ' ' . __( 'Starting uploading files...', 'WPMove' ) . ' ';
+
+ $this->flush_output();
+
+ // Changes the present working directory to the backup directory on the remote server
+ $ftp->chdir( $wpmove_options['ftp_'.$server.'_remote_path'] );
+
+ // Start counting errors during the file upload
+ $error_count = 0;
+
+ // Upload the given backup files under the backup folder to the server
+ foreach ( $files as $file ) {
+ printf( __( '%s is being uploaded...', 'WPMove' ), basename( $file ) );
+ $this->flush_output();
+ if ( FALSE !== ( $ftp->put( trailingslashit( WPMOVE_BACKUP_DIR ) . $file, basename( $file ) ) ) ) {
+ echo '' . __( ' Success!', 'WPMove' ) . ' ';
+ } else {
+ echo '' . __( ' Failed!', 'WPMove' ) . ' ';
+ $error_count++;
+ }
+ $this->flush_output();
+ }
+
+ // Notify the user about the errors occured
+ if ( $error_count )
+ printf( _n( 'Uploading files is completed with %d error...', 'Uploading files is completed with %d errors...', $error_count, 'WPMove' ), $error_count );
+ else
+ _e( 'Uploading files is completed without an error...', 'WPMove' );
+
+ $this->flush_output();
+
+ echo ' ';
+ _e( 'Closing the FTP connection...', 'WPMove' );
+ echo ' ';
+
+ // Close the connection
+ $ftp->quit();
+
+ // Return TRUE on success
+ return TRUE;
+ }
+
+ // Close the connection
+ $ftp->quit();
+ }
+
+ echo ' ' . __( ' Failed!', 'WPMove' ) . ' ' . __( 'Operation terminated...', 'WPMove' ) . ' ';
+
+ // If it reaches here, apparently it failed
+ return FALSE;
+ }
+
+ /**
+ * Handles the migration completing process.
+ *
+ * @param void
+ * @return void
+ */
+ function print_complete_migration_page() {
+
+ // If the user clicks the proceed link...
+ if ( $_POST && check_admin_referer( 'wpmove_complete_migration_start' ) ) {
+
+ ?>
+
+
+
+
+
+
+ ';
+ printf( __( '%s is being imported...', 'WPMove' ), basename( $file ) );
+
+ $this->flush_output();
+
+ echo ' ';
+
+ if ( wpmove_import_db_backup( basename( $file ) ) ) {
+ _e( 'Success!', 'WPMove' );
+ } else {
+ $errors_occured++;
+ _e( 'Failed!', 'WPMove' );
+ if ( ! is_readable( $file ) )
+ echo ' ' . __( 'Check file permissions...', 'WPMove' );
+ }
+
+ echo ' ';
+
+ } else if ( 'zip' == $ext ) {
+
+ echo '';
+ printf( __( '%s is being extracted...', 'WPMove' ), basename( $file ) );
+
+ $this->flush_output();
+
+ echo ' ';
+
+ if ( wpmove_extract_archive( basename( $file ), ABSPATH ) ) {
+ _e( 'Success!', 'WPMove' );
+ } else {
+ $errors_occured++;
+ _e( 'Failed!', 'WPMove' );
+ if ( ! is_readable( $file ) )
+ echo ' ' . __( 'Check file permissions...', 'WPMove' );
+ }
+
+ echo ' ';
+ }
+ }
+ }
+
+ // If there were errors, notify the user
+ if ( ! isset( $errors_occured ) )
+ _e( 'Please select files to migrate before proceeding!', 'WPMove' );
+ else {
+ echo ' ';
+ if ( $errors_occured > 0 )
+ printf( _n( 'Migration has been completed but with %d error.', 'Migration has been completed but with %d errors.', $errors_occured, 'WPMove' ), $errors_occured );
+ else
+ _e( 'Migration has been completed successfully!', 'WPMove' );
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+ 1 ) {
+
+ ?>
+
+
+
+
+
+ get_admin_options();
+
+ // An array to hold backup files that will be uploaded
+ $backups = array();
+
+ // Create a backup of the database
+ wpmove_create_db_backup( $wpmove_options['db_chunk_size'] );
+
+ if ( isset( $_POST['wpmove_create_full_backup'] ) ) {
+
+ // List all of the files inside the main directory
+ $abspath = substr( ABSPATH, 0, strlen( ABSPATH ) - 1 );
+ $files = wpmove_list_all_files( $abspath, FALSE, array( WPMOVE_DIR, WPMOVE_BACKUP_DIR, WPMOVE_OLD_BACKUP_DIR ) );
+
+ // Create chunks from the selected files
+ $chunks = wpmove_divide_into_chunks( $files, $wpmove_options['fs_chunk_size'] );
+
+ // To prevent overwriting archives created in the same second
+ $chunk_id = 1;
+
+ // Create an archive of the each chunk
+ foreach ( $chunks as $chunk )
+ wpmove_create_archive( $chunk, ABSPATH, $chunk_id++ );
+
+ }
+
+ }
+
+ ?>
+