WordPress.org

Forums

[resolved] Image upload directory, what a mess... (5 posts)

  1. GuardianAngel
    Member
    Posted 1 year ago #

    Hi!

    I have a multi-site, multi-network WordPress 3.9.2 install which seems to be very confused when it comes to the image upload directory it uses...

    The initial network uses wp-content/uploads/sites/SITE_ID...

    The second network I added wants to use /wp-content/blogs.dir/20/files/sites/SITE_ID...

    None of these have an "upload path" as far as I can tell..

    Now, the third one I added as a test wants to use wp-content/uploads/sites/23... (23 being the site id of the first site in this network) as an upload path for all sites...

    How come all of these networks behave in a very different way?

    Now for me that install was always a 3.9.1 install but this install was initially done on a VPS image (I use a VPS) so it is possible that it was not always a 3.9.1 install.

    To support multi-networks I used a well-known plugin to do this and I contacted the plugin author which tried to help but it seems to be a problem with my install so I stopped bugging him about this...

    Now I would like to somehow cleanup my install but I don't want to lose what I already did...

    How can I do this? What can I do to fix this?

    Thank you!

    Nick

  2. The second network I added wants to use /wp-content/blogs.dir/20/files/sites/SITE_ID...

    It should be /wp-content/uploads/sites/SITE_ID/ actually.

    Now for me that install was always a 3.9.1 install but this install was initially done on a VPS image (I use a VPS) so it is possible that it was not always a 3.9.1 install.

    That may be a problem, then, because if the 'image' had a poorly done install of WP, that would explain a lot.

    Read over http://halfelf.org/2012/dumping-ms-files/ - You SHOULD be able to use the general concept to force yours around to the right, uploads, place and fix it.

    That said, NEVER use an 'image' to install WordPress. It prevents WP from being able to auto-detect and properly set things up.

  3. GuardianAngel
    Member
    Posted 1 year ago #

    Hi!

    It should be /wp-content/uploads/sites/SITE_ID/ actuall

    So it should be like the first network which does have that structure, right?

    That may be a problem, then, because if the 'image' had a poorly done install of WP, that would explain a lot.

    The weird thing is that that poorly installed WordPress did behave normally until I added networks...

    The thing I don't get is why the second network and the third behave in very different way... If the install of the first network is somehow corrupted (but still gives the expected results as far as image upload path is concerned) and it is used as some sort of template for the second and the third then why do I end up with verrry different things for the second and third network? I end up with blogs.dir for the second network and something similar to one of the problems you had for the third network (/wp-content/uploads/sites/25/sites/26/...) because the upload_path got set for the sites of this network automagically.

    (It's 25 now instead of 23 as I destroyed the network and recreated it and the new upload_path is wp-content/uploads/sites/25...)

    The third network appears to behave similarly to the first network with the exception that this time the upload paths got set... If I cleared them then I think it would behave normally but why did they get set in the first place?

    That said, NEVER use an 'image' to install WordPress. It prevents WP from being able to auto-detect and properly set things up.

    I definitely learned my lesson and I wished I could restart with a clean database... If I exported everything with EXPORT, IMPORTed it back in a clean database and altered the path to the images would this have a better chance of ending up with a working install which would not do something else weird the next time I create another network?

    I could hack my config as you suggested but what I am afraid of is keeping that corruption which makes it behaves differently each time I create a new network so if exporting and importing into a new database has a better chance of getting rid of the "corruption" then I would go that way.

    The second network has barely any images so I could re-upload them or I could move them from their incorrect location to the correct one too and the third network was only done as a test for now...

    So, what would be best in my case?

    Thank you very much for your help and have a nice day!

    Nick

  4. I would make a backup of the DB and try to manually move things around and fix it back to normal, but I'm also a little insane.

  5. GuardianAngel
    Member
    Posted 1 year ago #

    Hi Mika!

    Just to let you know what I ended up doing...

    I did a backup of my DB as you suggested but before trying to hack it I checked if there was a way to fix it without resorting to that... As I am far from an expert in WordPress I thought it would be best if I tried the easier solutions first...

    In my DOS days I directly altered a database structure by using an HEX editor but I knew what I was doing, I can't say the same for hacking a WordPress database...

    So, once I had my backup I did some tests...

    Now it looked like the main problem with my third network was the fact that the upload path was set and it should not have been I believed...

    I cleared it and it seemed to behave normally...

    So what I did was export the sites I wanted to export from the second network and deleted it...

    I then recreated it...

    It behave like the third network, everything seemed good AFAICT expect for the upload path, I cleared it...

    I reimported the sites I had exported and fixed a few broken links...

    It now behaves as it should I believe...

    I am no PHP expert (I am a programmer though, not just a PHP programmer) and it looks like it's the multi-network plugin I use that setted that upload path in this way so I will have to contact the plugin author again about this so we can figure out why his plugin consistently set the upload path to something wrong on my install...

    By the way, I found a note somewhere which suggests that image was initially of 3.8 but from what I have read blog.dir was no longer in use for 3.8, right?

    Thank you!

    Nicolas

Topic Closed

This topic has been closed to new replies.

About this Topic