Skip to content

Commit

Permalink
Deploying version 0.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
JRGould committed Dec 15, 2016
1 parent fb5782b commit e607c7b
Show file tree
Hide file tree
Showing 19 changed files with 239 additions and 199 deletions.
2 changes: 1 addition & 1 deletion asset/dist/css/styles.css

Large diffs are not rendered by default.

File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 0 additions & 3 deletions asset/dist/js/script-09.min.js

This file was deleted.

14 changes: 12 additions & 2 deletions asset/dist/js/script-09.js → asset/dist/js/script-091.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ var MigrationProgressStage = Backbone.Model.extend( {
dataType: 'local',
name: '',
itemsComplete: 0,
itemsCompleteArr: [],
strings: null
},
initialize: function() {
Expand All @@ -436,6 +437,7 @@ var MigrationProgressStage = Backbone.Model.extend( {
this.set( '_initialItems', this.get( 'items' ).slice() );
this.set( 'items', [] );
this.set( 'lookupItems', {} );
this.set( 'itemsCompleteArr', [] );

_.each( this.get( '_initialItems' ), function( item ) {
this.addItem( item.name, item.size, item.rows );
Expand Down Expand Up @@ -514,6 +516,14 @@ var MigrationProgressStage = Backbone.Model.extend( {
wpmdb.current_migration.model.trigger( 'change:activeStage' );
},
setItemComplete: function( itemName ) {

// Guard: return if item has already been set complete
var itemsCompleteArr = this.get( 'itemsCompleteArr' );
if ( ~itemsCompleteArr.indexOf( itemName ) ) {
return;
}
itemsCompleteArr.push( itemName );

var item = this.getItemByName( itemName );
var totalTransferred = this.get( 'totalTransferred' );
var itemsComplete = this.get( 'itemsComplete' );
Expand Down Expand Up @@ -2846,13 +2856,13 @@ module.exports = MigrationProgressStageView;
$( '.connection-status' ).hide();
$( '.step-two' ).show();
$( '.table-prefix' ).html( wpmdb_data.this_prefix );
$( '.compatibility-older-mysql' ).show();
if ( false === profile_name_edited ) {
$( '.create-new-profile' ).val( '' );
}

if ( 'find_replace' !== wpmdb_migration_type() ) {
if ( 'savefile' === wpmdb_migration_type() ) {
$( '.backup-options' ).hide();
$( '.compatibility-older-mysql' ).show();
}

$( '.keep-active-plugins' ).hide();
Expand Down
3 changes: 3 additions & 0 deletions asset/dist/js/script-091.min.js

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions class/wpmdb-base.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,15 @@ function pro_addon_construct() {
$this->addons = array(
'wp-migrate-db-pro-media-files/wp-migrate-db-pro-media-files.php' => array(
'name' => 'Media Files',
'required_version' => '1.4.5',
'required_version' => '1.4.7',
),
'wp-migrate-db-pro-cli/wp-migrate-db-pro-cli.php' => array(
'name' => 'CLI',
'required_version' => '1.2.5',
'required_version' => '1.3',
),
'wp-migrate-db-pro-multisite-tools/wp-migrate-db-pro-multisite-tools.php' => array(
'name' => 'Multisite Tools',
'required_version' => '1.1.3',
'required_version' => '1.1.5',
),
);

Expand Down Expand Up @@ -429,7 +429,7 @@ function remote_post( $url, $data, $scope, $args = array(), $expecting_serial =
} elseif ( $expecting_serial && 'ajax_verify_connection_to_remote_site' == $scope ) {
$unserialized_response = WPMDB_Utils::unserialize( $response['body'], __METHOD__ );
if ( false !== $unserialized_response && isset( $unserialized_response['error'] ) && '1' == $unserialized_response['error'] && 0 === strpos( $url, 'https://' ) ) {
if ( 0 === strpos( $unserialized_response, '(#122)' ) ) {
if ( false === strpos( $unserialized_response['message'], '(#122)' ) ) {
return $this->retry_remote_post( $url, $data, $scope, $args, $expecting_serial );
}
}
Expand Down Expand Up @@ -825,7 +825,7 @@ function verify_download( $response, $args, $url ) {

$download_url = $this->get_plugin_update_download_url( $this->plugin_slug );

if ( 0 === strpos( $url, $download_url ) || 402 != $response['response']['code'] ) {
if ( false === strpos( $url, $download_url ) || 402 != $response['response']['code'] ) {
return $response;
}

Expand Down Expand Up @@ -1776,7 +1776,7 @@ public function subsites_list() {


if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
$sites = get_sites( array( 'limit' => 0 ) );
$sites = get_sites( array( 'number' => false ) );
} else {
$sites = wp_get_sites( array( 'limit' => 0 ) );
}
Expand Down Expand Up @@ -1834,7 +1834,7 @@ public function subsites_info() {
}

if ( version_compare( $GLOBALS['wp_version'], '4.6', '>=' ) ) {
$sites = get_sites( array( 'limit' => 0 ) );
$sites = get_sites( array( 'number' => false ) );
} else {
$sites = wp_get_sites( array( 'limit' => 0 ) );
}
Expand All @@ -1846,6 +1846,7 @@ public function subsites_info() {
foreach ( $sites as $subsite ) {
$subsite = (array) $subsite;
$subsites[ $subsite['blog_id'] ]['site_url'] = get_site_url( $subsite['blog_id'] );
$subsites[ $subsite['blog_id'] ]['home_url'] = get_home_url( $subsite['blog_id'] );
$subsites[ $subsite['blog_id'] ]['uploads'] = $this->uploads_info( $subsite['blog_id'] );

$subsites[ $subsite['blog_id'] ]['uploads']['url'] = substr_replace( $subsites[ $subsite['blog_id'] ]['uploads']['url'], $subsites[ $subsite['blog_id'] ]['site_url'], 0, strlen( $primary_url ) );
Expand Down Expand Up @@ -1973,6 +1974,7 @@ public function site_details() {
$site_details = array(
'is_multisite' => esc_html( is_multisite() ? 'true' : 'false' ),
'site_url' => esc_html( addslashes( site_url() ) ),
'home_url' => esc_html( addslashes( home_url() ) ),
'prefix' => esc_html( $table_prefix ),
'uploads_baseurl' => esc_html( addslashes( trailingslashit( $uploads['baseurl'] ) ) ),
'uploads' => $this->uploads_info(),
Expand Down
15 changes: 8 additions & 7 deletions class/wpmdb-replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,15 @@ function detect_protocol_mismatch() {
*
* @param array
*/
$wpmdb_site_urls = apply_filters( 'wpmdb_replace_site_urls', array(
'local' => $this->site_details['local']['site_url'],
'remote' => $this->site_details['remote']['site_url'],
$wpmdb_home_urls = apply_filters( 'wpmdb_replace_site_urls', array(
// TODO: rewrite unit tests that only pass site_url so that we can rely on home_url's existence
'local' => isset( $this->site_details['local']['home_url'] ) ? $this->site_details['local']['home_url'] : $this->site_details['local']['site_url'],
'remote' => isset( $this->site_details['remote']['home_url'] ) ? $this->site_details['remote']['home_url'] : $this->site_details['remote']['site_url'],
)
);

$local_url_is_https = false === stripos( $wpmdb_site_urls['local'], 'https' ) ? false : true;
$remote_url_is_https = false === stripos( $wpmdb_site_urls['remote'], 'https' ) ? false : true;
$local_url_is_https = false === stripos( $wpmdb_home_urls['local'], 'https' ) ? false : true;
$remote_url_is_https = false === stripos( $wpmdb_home_urls['remote'], 'https' ) ? false : true;
$local_protocol = $local_url_is_https ? 'https' : 'http';
$remote_protocol = $remote_url_is_https ? 'https' : 'http';

Expand All @@ -128,11 +129,11 @@ function detect_protocol_mismatch() {
if ( 'push' === $this->intent ) {
$this->destination_protocol = $remote_protocol;
$this->source_protocol = $local_protocol;
$this->destination_url = $wpmdb_site_urls['remote'];
$this->destination_url = $wpmdb_home_urls['remote'];
} else {
$this->destination_protocol = $local_protocol;
$this->source_protocol = $remote_protocol;
$this->destination_url = $wpmdb_site_urls['local'];
$this->destination_url = $wpmdb_home_urls['local'];
}

return $this->is_protocol_mismatch;
Expand Down
8 changes: 3 additions & 5 deletions class/wpmdb-utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ public static function unserialize( $serialized_string, $method = '' ) {
$serialized_string = trim( $serialized_string );
$unserialized_string = @unserialize( $serialized_string );

if ( false === $unserialized_string ) {
$wpmdb = function_exists( 'wp_migrate_db_pro' ) ? wp_migrate_db_pro() : wp_migrate_db();
if ( false === $unserialized_string && defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
$scope = $method ? sprintf( __( 'Scope: %s().', 'wp-migrate-db' ), $method ) : false;
$wpmdb->log_error( __( 'Data cannot be unserialized.', 'wp-migrate-db' ), $scope );

return false;
$error = sprintf( __( 'WPMDB Error: Data cannot be unserialized. %s', 'wp-migrate-db' ), $scope );
error_log( $error );
}

return $unserialized_string;
Expand Down
40 changes: 27 additions & 13 deletions class/wpmdb.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,21 +916,21 @@ function ajax_initiate_migration() {
// A little bit of house keeping.
WPMDB_Migration_State::cleanup();

if ( 'savefile' === $this->state_data['intent'] || 'find_replace' === $this->state_data['intent'] ) {
if ( in_array( $this->state_data['intent'], array( 'find_replace', 'savefile' ) ) ) {
$return = array(
'code' => 200,
'message' => 'OK',
'body' => json_encode( array( 'error' => 0 ) ),
);

if ( 'find_replace' !== $this->state_data['intent'] || 'backup' === $this->state_data['stage'] ) {
$return['dump_path'] = $this->get_sql_dump_info( 'migrate', 'path' );
if ( in_array( $this->state_data['stage'], array( 'backup', 'migrate' ) ) ) {
$return['dump_path'] = $this->get_sql_dump_info( $this->state_data['stage'], 'path' );
$return['dump_filename'] = basename( $return['dump_path'] );
$return['dump_url'] = $this->get_sql_dump_info( 'migrate', 'url' );
$return['dump_url'] = $this->get_sql_dump_info( $this->state_data['stage'], 'url' );
$dump_filename_no_extension = substr( $return['dump_filename'], 0, -4 );

$create_alter_table_query = $this->get_create_alter_table_query();
// sets up our table to store 'ALTER' queries
$create_alter_table_query = $this->get_create_alter_table_query();
$process_chunk_result = $this->process_chunk( $create_alter_table_query );

if ( true !== $process_chunk_result ) {
Expand All @@ -939,15 +939,29 @@ function ajax_initiate_migration() {
return $result;
}

if ( 'savefile' === $this->state_data['intent'] && $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
$return['dump_path'] .= '.gz';
$return['dump_filename'] .= '.gz';
$return['dump_url'] .= '.gz';
}
if ( 'savefile' === $this->state_data['intent'] ) {
if ( $this->gzip() && isset( $this->form_data['gzip_file'] ) && $this->form_data['gzip_file'] ) {
$return['dump_path'] .= '.gz';
$return['dump_filename'] .= '.gz';
$return['dump_url'] .= '.gz';
}

$this->fp = $this->open( $this->get_upload_info( 'path' ) . DIRECTORY_SEPARATOR . $return['dump_filename'] );
$this->db_backup_header();
$this->close( $this->fp );
$upload_path = $this->get_upload_info( 'path' );
if ( false === $this->filesystem->is_writable( $upload_path ) ) {
$error = sprintf( __( '<p><strong>Export Failed</strong> — We can\'t save your export to the following folder:<br><strong>%s</strong></p><p>Please adjust the permissions on this folder. <a href="%s" target="_blank">See our documentation for more information »</a></p>', 'wp-migrate-db' ), $upload_path, 'https://deliciousbrains.com/wp-migrate-db-pro/doc/uploads-folder-permissions/' );
$return = array(
'wpmdb_error' => 1,
'body' => $error,
);
$result = $this->end_ajax( json_encode( $return ) );

return $result;
}

$this->fp = $this->open( $upload_path . DIRECTORY_SEPARATOR . $return['dump_filename'] );
$this->db_backup_header();
$this->close( $this->fp );
}

$return['dump_filename'] = $dump_filename_no_extension;
}
Expand Down
Loading

0 comments on commit e607c7b

Please sign in to comment.