Cloner Plugin not copying media library

We're experiencing a problem across our multisite install where we clone a site and it doesn't copy the media library (or in some cases, it does sporadically). The most recent example is an attempt to clone the subsite "progress" to overwrite "newprogress". You may overwrite "newprogress" if you need to test.

Everything goes well, until it gets to the media, then it returns the following 404 error on each media item:

Remote server returned error response 404 Not Found - http://progress.oglethorpe.edu/wp-content/uploads/2015/09/imagename.jpg
It seems that the path that cloner is looking for media is different than the path where our media resides. For instance, cloner is looking for http://progress.oglethorpe.edu/wp-content/uploads/2015/09/11923194_857460137673689_4231487079944999389_n.jpg
but the actual url in the media library is http://progress.oglethorpe.edu/files/2015/09/11923194_857460137673689_4231487079944999389_n.jpg

So instead of /wp-content/uploads/ our files are stored at /files/

I've checked the site settings for that site, which shows:
upload path: wp-content/blogs.dir/3/files
upload url path: http://progress.oglethorpe.edu/wp-content/uploads
Fileupload url http://progress.oglethorpe.edu/files

I've never done anything to change any of these settings.

We are using the cloner plug-in to clone sites to apply new themes and update while the original site remains live, then we clone back to overwrite the original.

  • Luís

    Hi @oglethorpeuniv,

    Hope you're doing well today!

    I will flag the SLS team (our code experts ) to get their valuable feedback.

    Can you send us the FTP details of your website, so we can investigate it further.

    Please send it privately through our contact form:

    https://premium.wpmudev.org/contact/

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: "Attn: Luis Lopes"
    - WordPress admin username
    - WordPress admin password
    - Login url
    - FTP credentials (host/username/password)
    - Link back to this thread for reference
    - Any other relevant urls

    Cheers, Luís

  • jtoddb

    We're also having an issue with links:

    When we’ve used the cloner tool to launch a new site, all links in the new subsite still lead to the dev URL (for example, when we launched summer we still had links going to newsummer.oglethorpe.edu. I had to go through and manually change them all. This happened even when I used the page selector tool instead of inserting the link directly.)

    I'm about to launch a 360 page subsite that has many hundreds of links, so getting this to work is critical.

  • Ivan Shulev

    Hey @oglethorpeuniv,

    My sincerest apologies for the late reply!

    I made some testing on your website and found out that while the plugin is cloning, the URLs of the images from the initial website (progress) are pointing to wp-content/uploads instead of files.

    One possible reason is the fact that prior to WP 3.5, the uploads folder was set in the admin and then stored in the database and after it is supposed to be set in configuration files (wp-config.php or through filters). I see that the initial website was registered before 3.5 (https://codex.wordpress.org/Version_3.5) was released so if the database hasn't been updated since, this is a possible cause of the issue.

    Another might be that the main site is updated, but the subsites are not. Either way, since everything else is working fine, I decided to add the following filter function:

    <?php
    	add_filter('upload_dir', 'wpmu_correct_uploads_url');
    
    	function wpmu_correct_uploads_url( $param ){
    		if(1 !== get_current_blog_id()) {
    			$param['url'] = str_replace('wp-content/uploads', 'files', $param['url']);
    			$param['baseurl'] = str_replace('wp-content/uploads', 'files', $param['baseurl']);
    		}
    		return $param;
    	}

    This code can be found in the wp-content/mu-plugins folder under the name wpmudev-uploadsdir-filter.php. The code above filters through all upload folder requests (except the ones made for the main site, since it's URL structure is different) and replaces wp-content/uploads with files, if found.

    Regarding your more recent post, about the links, do you mean the Media URLs in posts/pages?

    I only cloned progress to newprogress and the links were properly pointing to the new site.

    Please test again with the aforementioned code that I took the liberty of adding (I hope you don't mind).

    If the issue persists, please provide a bit more details and sites which I could clone to see the problem firsthand.

    I hope this helps and I wish you an awesome day ahead!

    Ivan