WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Importer
Still Having Media Import Issues from self-hosted to self-hosted (8 posts)

  1. kennibc
    Member
    Posted 8 months ago #

    From WP 3.5.2 and newer there is still a bug that fails to import media from two self-hosted (multisite setup) blogs.

    Here is the scenerio:
    Export Blog (WP 3.5.2 or WP 3.6 - doesn't matter) is on a Multisite setup with sub directories. Export all content and using default twenty eleven theme. Nothing special.

    Import blog (WP 3.5.2 or 3.6-doesn't matter) is on a completely different server with a different ip address and domain name. Import fails to import media with a message of Failed to connect to server. Posts and everything else works fine. Just the media import fails.

    Same setup but if you run WP3.5.1 on the server you are trying to import to then EVERYTHING WORKS!

    Some bug was introduced in WP 3.5.2 that prohibits importing of media when the wordpress installs are on different servers/IPs/DNS names.

    A wordpress 3.5.1 install will import from any version. Since WP3.5.2 media importing has been broken for us. I am not sure if this has anything to do with our setups being multisite.

    http://wordpress.org/plugins/wordpress-importer/

  2. kennibc
    Member
    Posted 8 months ago #

    I should also note that because we are on a multisite setup I can use the export import method with no issues in WP 3.5.2+ if we are staying on the same server. Meaning, Blog A is exported and imported into Blog B on the same multisite setup and all media is imported properly.

    This issue only seems to appear when going from 2 separate servers with different IPs and DNS names.

  3. kennibc
    Member
    Posted 8 months ago #

    Has anyone else been able to verify that media import works with 3.6 or 3.5.2 going to separate servers and installs?

  4. burneyrg
    Member
    Posted 8 months ago #

    Confirm that the import/export process in WP 3.5.2 failed to transfer links on my pages. Macintosh computers using MAMP/localhost.
    Struggling to transfer work from home to school and back. Nothing works.

  5. maxwelton
    Member
    Posted 6 months ago #

    I may have a fix for this. From what I can see, there is a new piece of base site url information that the importer doesn't know about; or, perhaps, not being a multi-site expert, it may have something to do with how you configure your media storage. In any case, here are the mods that worked for me.

    In the "wordpress importer 0.6.1" plugin, I had to modify two files in the importer plugin:

    In parsers.php:

    After line 92 (look for '$base_url' in line 92), add these two lines:

    $base_blog_url = $xml->xpath('/rss/channel/wp:base_blog_url');
    $base_blog_url = (string) trim( $base_blog_url[0] );

    In wordpress-importer.php:

    After line 50 ("$base_url...") add a new line:

    var $base_blog_url = '';

    Now, change line 156 ("$this->base_url = esc_url( $import_data['base_url'] );") to:

    $this->base_url = ! empty($import_data['base_blog_url']) ? esc_url( $import_data['base_blog_url'] ) : esc_url( $import_data['base_url'] );

    That allowed me to import my content. Hope this works for you.

  6. kennibc
    Member
    Posted 6 months ago #

    Thanks Maxwelton.
    I will look into this and try out your solution. We are finished though with importing content between the two sites but this may still be useful in the future.

  7. leomuniz
    Member
    Posted 5 months ago #

    Hey guys.
    I think I have the solution. For me, it worked, but I have encountered another problem, cause the blog I'm working with has many photos on a single post. This huge mass of Mb drives me crazy and I gave up using this import method, creating one on my own.

    Here what I found after a little research on the code:
    In version 3.5.2 the function wp_http_validate_url was introduced (file: /wp-includes/http.php). For some reason that I don't care, this function validates URLs that wordpress try to reach and I don't know if it is really important for other validations.

    The function that import media files (function request() at line 81 of /wp-includes/class-http.php file) calls this URL validation function on line 124 and, I don't know why, the returned value is always blank (empty string) even with a valid url, causing error on the line 131 of class-http.php ('A valid URL was not provided.').

    To solve this problem you need to comment this piece of code (starting at line 122 until line 126):

    /*
    if ( function_exists( 'wp_kses_bad_protocol' ) ) {
    	if ( $r['reject_unsafe_urls'] )
    		$url = wp_http_validate_url( $url );
    	$url = wp_kses_bad_protocol( $url, array( 'http', 'https', 'ssl' ) );
    }
    */

    I strongly recommend to uncomment this after importing your media files. This validation function is there for some reason and leaving this commented won't be a good idea.

    Hope I helped!
    best regards

  8. Marco
    Member
    Posted 5 months ago #

    Thank You!!!

Reply

You must log in to post.

About this Plugin

About this Topic