wp-migrate-db
wp-migrate-db copied to clipboard
1s timeout is too less to verify the https connection
If the remote site is delayed, a 1s timeout for fsockopen() is too less to verify whether the remote site is on:
if( function_exists( 'fsockopen' ) && strpos( $url, 'https://' ) === 0 && $scope == 'ajax_verify_connection_to_remote_site' ) {
$url_parts = parse_url( $url );
$host = $url_parts['host'];
if( $pf = @fsockopen( $host, 443, $err, $err_string, 1 ) ) {
// worked
fclose( $pf );
}
else {
// failed
$url = substr_replace( $url, 'http', 0, 5 );
}
}
https://github.com/wp-sync-db/wp-sync-db/blob/master/class/wpsdb-base.php#L86