WordPress.org

Ready to get started?Download WordPress

Forums

WP2Cloud
Wish: ClouSE Import plugin (5 posts)

  1. Per Soderlind
    Member
    Posted 1 year ago #

    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 :)

    Br,
    PerS - http://soderlind.no/

    http://wordpress.org/extend/plugins/wp2cloud-wordpress-to-cloud/

  2. Artem Livshits
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. Per Soderlind
    Member
    Posted 1 year ago #

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

    <?php
    $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 );
    
    				$wpdb->query($sql);
    			}
    		}
    	}
    }
    $wpdb->flush();

    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)

  4. Artem Livshits
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  5. Per Soderlind
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.