WordPress.org

Ready to get started?Download WordPress

Forums

NS Cloner - Site Copier
[resolved] help! subsite cloned fine, but all images ahe broken icon (9 posts)

  1. maxgx
    Member
    Posted 4 months ago #

    hi guys, i hope you can help me out with this, i've been searching for a solution but can't pinpoint it.

    i've used your (fantastic!) plugin and was able to clone the main site into a subdirectory. all content and options were fine, but images are showing the broken icon.

    moreover, the path /uploads/sites/NUMBER does not exist, but i was able to upload an image absolutely fine in the subsite.
    i've been searching for the image with an FTP client inside the entire /uploads folder, but there's no sign of it... where is that stored?

    from what i've read, there's a difference between pre 3.5 and post 3.5 WP way of handling path on mu installs.

    i've seen people suggesting tweaks to your plugin file, but i'm not sure that's necessary, i think it's only a matter of remapping the path, somehow...

    do i have to resort to a mysql find/replace on the database itself or is there any hack/tweak/plugin/solution i may try?

    https://wordpress.org/plugins/ns-cloner-site-copier/

  2. Never Settle
    Member
    Plugin Author

    Posted 4 months ago #

    Hopefully, we can help, but there are lots of possible causes that could be involved. Let's try to narrow it down:

    WP multisite does handle uploads differently before 3.5. Does your WP network predate 3.5 even if it has been upgraded to the latest? If so, the uploads folder for the main site will still be /wp-content/uploads (which SHOULD exist no matter what, UNLESS it was setup with a custom uploads folder from the beginning). The uploads folders for all subsites should be under /wp-content/blogs.dir/## where ## is the ID of the subsite.

    If your WP network was installed originally with WP 3.5 or later then your structure SHOULD be /wp-content/uploads for the main site and /wp-content/uploads/sites/## for subsites.

    If none of those structures exist, then you might have a custom uploads structure. The cloner will detect some custom uploads structures as long as they are correctly registered with WP. But if a custom structure relies only on .htaccess rewrite rules or another mechanism, then there's no way the Cloner can detect this - especially if the folders are not the "standard" ones.

    Both plugins and themes can override / change the uploads locations.

    It's extremely irregular for the /wp-content/uploads folder not to exist. Are you sure it's not there?

    Do these clues help you investigate further?

    The Cloner will do its best to autodetect where a site's uploads folder is, but if it isn't one of the standard ones, and if it isn't registered properly with WP, then the Cloner will most likely not work correctly for media file copy and automatic file URL updates.

    Let us know if this helps with any progress.

  3. maxgx
    Member
    Posted 4 months ago #

    hi, and thanks for the prompt reply!

    1) Does your WP network predate 3.5 even if it has been upgraded to the latest?

    nope, it's been installed as 3.8.1, then set as MS.

    2) your structure SHOULD be /wp-content/uploads for the main site and /wp-content/uploads/sites/## for subsites

    it is /wp-content/uploads, but there's no sign of /wp-content/uploads/sites/## - but uploading an image on subsite and viewing path shows /SUBSITE/wp-content/uploads/sites/##/img.xxx - i thought that was some sort of remapping trick, from what you're saying the directory is physically created... but i have no /SUBSITE... *confused*

    3) If none of those structures exist, then you might have a custom uploads structure

    rest assured that is not the case.

    4) It's extremely irregular for the /wp-content/uploads folder not to exist. Are you sure it's not there?

    i've been checking several times, both with a FTP client on my pc and with a FileManager on server: the standard MAINSITE/wp-content/uploads is there fine, there's no sign of MAINSITE/wp-content/uploads/sites nor SUBSITE/wp-content/uploads/sites (but the latter i'm pretty sure is achieved through remapping in .htaccess).

    still, images uploaded through WP media manager in SUBSITE do work fine, and show at SUBSITE/wp-content/uploads/sites/##/img.xxx

    i've just downloaded the entire /wp-content/uploads folder and run a search for the file uploaded on the subsite, and the file is not there... i have no idea how i can be able to open it up on the browser at /SUBSITE/wp-content/uploads/sites/##/img.xxx

  4. Never Settle
    Member
    Plugin Author

    Posted 4 months ago #

    Interesting.

    So if you run through this scenario (leave the Cloner out of the loop for the moment, just to make sure):

    1. Create a brand new site using wp-admin/network/ > Sites > Add Site which will give you a completely blank site with the default template
    2. On that site, use media manager and upload an image to the default "Hello World" post.

    You're saying:
    1. That image will show up on the post with an image URL of SUBSITE/wp-content/uploads/sites/##/img.xxx
    2. BUT, there's no /wp-content/uploads/sites/##/img.xxx ???

    Bizarre, I don't know what else to suggest, unless there is a weird FTP issue... folder caching or something else going on.

    Have you tried manually getting to that path? For example manually paste in /wp-content/uploads/sites/ in your location or look at the ID of a site in All Sites and manually try to go to /wp-content/uploads/sites/ID

    Otherwise, it would seem like a hosting issue.

    WP does indeed handle the redirect difference between
    MAINSITE/wp-content
    and
    SUBSITE/wp-content

    Sounds like a mystery. Any other thoughts? I'm stumped.

  5. maxgx
    Member
    Posted 4 months ago #

    ok, just did what you asked:

    1) created subsite 'test' from Sites->Add Site

    2) edited subsite's 'Hello World' by adding an image

    3) image appears on post, image can be called up on browser, path is:
    ROOT/_/test/wp-content/uploads/sites/5/2014/04/avatar.gif

    4) no sign of /sites (hence no sign of /sites/5, or /sites/5/2014 etc.)

    > Sounds like a mystery. Any other thoughts? I'm stumped.

    are you? imagine me...

    anyways, this means the issue is not related to running your plugin, but i wonder if it can help me solving it nevertheless: i was reading of people tampering with your plugin file to force it to use wp-content/uploads rather than blogs.n - although i understand that was needed for WP up to 3.5.
    do you think i could try something like that? and if yes, which lines do i have to work on?

  6. Never Settle
    Member
    Plugin Author

    Posted 4 months ago #

    I would not recommend that approach. That would mean all sites would be using the same folder for uploads. If you upload a file named background.jpg on one site and then did the same on another site, it would potentially replace the first one. And URLs would be a tangle.

    It would be much better to figure out what is going on with rewrites. That folder has to be somewhere. Did you say that you uploaded an image something called like "findme.jpg" and then search for that in your entire public_html ? Can you try that to see where it might be landing?

    I would get your WP multisite installation stable first. And if you just started (not a ton of work into it yet) then it would be totally worth it starting over from scratch.

    You might also scrub your .htaccess against the ones published in the WP codex for your install type. Trust me, you don't want to start modifying plugins to work around a quirky install. You should address the core problem and get your install stable first, cause otherwise it will only come back to bit you later with other plugins or whatnot and the stakes will only get higher the more data you put in there.

  7. maxgx
    Member
    Posted 4 months ago #

    after speaking with support, i may have found out the reason.

    the site is a merge of an old WP3.0.4 and a newer Drupal7, both exported and merged into this, with nearly 6000 posts and 5000 uploads (most of them loosely added in Drupal, without the year/month structure). it seems that this setup ("large and loose") may causes strange behaviors in apps, and (why not) plugins.

    using the webFTP, i noticed a text field at the top. i entered the path to /uploads/sites and voilĂ ! the directory was there.
    in it, i found the 4/2014/04 directories (SUBDIR/YYYY/MM) - the last two created when i've uploaded the image in the cloned post. the image is there ok.

    what is not there are the other directories, that NS Cloner was supposed to clone. probably a problem handling large amount of files?

    starting from an error like this:

    http://DOMAIN/SUBDIR/wp-content/uploads/sites/4/2010/09/IMAGE.jpg
    500 Internal Server Error

    i checked in SSH:

    USER@SSHADDRESS:~/www/_/wp-content/uploads
    drwxr-xr-x+ 5 UNAME users 5 12 avril 00:30 2014
    ... a regular directory
    drwxr-xr-x+ 6 UNAME users 6 15 avril 16:41 sites
    ... the /sites directory, finally!!!

    USER@SSHADDRESS:~/www/_/wp-content/uploads/sites
    drwxr-xr-x+ 2 UNAME users 2 13 avril 19:24 2
    drwxr-xr-x+ 3 UNAME users 3 15 avril 16:41 3
    drwxr-xr-x+ 3 UNAME users 3 13 avril 19:45 4
    ... this is what's inside /sites

    USER@SSHADDRESS:~/www/_/wp-content/uploads/sites/4
    drwxr-xr-x+ 3 UNAME users 3 13 avril 19:45 2014
    ... this is what's inside /sites/4 - no 2010/09

    i think i can solve it by manually copying the /uploads directory inside /sites/SUBDIR-ID, after all i need a quick, one-time solution, but maybe this scenario is something you would want to investigate further.

  8. maxgx
    Member
    Posted 4 months ago #

    maybe this can help any other poor soul who'll have to merge large amount of content from an improbable drupal setups into a wp multisite and then clone it with the (amazing!) ns cloner...

    it seems that the loose images within the cloned directory (which, for the reasons above, i had to create manually) cannot be found by WP in the cloned site.

    in the page, the path to image appears as:

    DOMAIN/SUBDIR/wp-content/uploads/sites/SUBDIR-ID/sites/SUBDIR-ID/IMG.jpg

    it may well be a rewrite thing in htaccess, i don't know, but suspect it's linked to the file not being in a YYYY/MM directory structure, but loose in the SUBDIR-ID directory.

    of course if anyone has any idea about it, s/he's welcome!

  9. Never Settle
    Member
    Plugin Author

    Posted 4 months ago #

    Glad you found it! And thanks for sharing what you found. Yes - a manual copy should work fine that way.

Reply

You must log in to post.

About this Plugin

About this Topic