Support » Plugin: WP2Cloud » Wish: ClouSE Import plugin

  • Hi,

    I’ve been testing ClouSE and I really like it. I started with the AMI with Linux, MySQL and ClouSE (not yappix), added nginx, WordPress , WP2Cloud etc etc.

    Importing my site using WordPress Tools->Import also works fine, images are moved to S3, the only problem is that the image urls in posts and pages aren’t updated (they still point to wp-content/uploads..)

    So … my suggestion is, and I believe this is the quickest fix ref your “migration tool”, that you create your ClouSE Import plugin, accessible from Tools->Import 🙂

    PerS –

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Artem Livshits


    Thank you for the suggestion!
    We are still working on the migration tools. Meanwhile the options are a) if the number of files is small, it might be easier to re-add them, otherwise b) we’ll be happy to recommend our partner company that will be able to assist in initial site setup and if needed ongoing maintenance.

    Please let us know if you’d like us to notify you as soon as we have the beta version of the migration solution available.

    I wrote a hack and ran it in debug bar console (did a backup of my database first (!!)):

    $myposts = $wpdb->get_results("SELECT ID, post_content FROM $wpdb->posts WHERE post_status = 'publish' AND post_type='post'");
    foreach ($myposts as $mypost) {
    	if(preg_match_all('#(https?:\/\/[\d\w\-\.\/]+\.(?:jpe?g|gif|png)(?!\.))#', $mypost->post_content, $matches)) {
    		$urls = $matches[0];
    		foreach($urls as $url) {
    			$parts = parse_url($url);
    			$filename = basename($parts['path']);
    			$wsql = "SELECT id,name FROM " . $wpdb->prefix . "cloud_media_content WHERE name = '" . $filename . "'"
    			$wblb = $wpdb->get_row($wsql);
    			if (isset($wblb->id) && isset($wblb->name)) {
    				$newurl = sprintf("/wp-content/plugins/wp2cloud-wordpress-to-cloud/wp2cloud.php?weblob_id=%s/%s",$wblb->id,$wblb->name);
    				$sql = $wpdb->prepare( "UPDATE $wpdb->posts SET post_content = REPLACE (post_content, '%s','%s') WHERE ID = %s", $url,$newurl,$mypost->ID );

    The code above (not supported, you run it on your own risk) will find all image urls and convert them to the correct wp2cloud format after a wordpress import (Tools->Import)

    Plugin Author Artem Livshits


    Hi Per,

    This is awesome!

    While it seems to have caveats, like it wouldn’t process non-image media files, files with non-standard names, etc. it is a good starting point that may work for many blogs until we have a migration solution available.

    Agree, but it you dare to run it I bet you can read code and understand how to add other formats 😉

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Wish: ClouSE Import plugin’ is closed to new replies.