Support » Plugin: Media Sync » Incorrect Scan Directory (slashes facing wrong way) causing problems

  • Resolved veriatech

    (@veriatech)


    Preface: I am a sysadmin running WordPress on a Windows Server 2019 + IIS + latest version of MySQL & WP.

    With this plugin installed, here is what it thinks my scan directory is:

    Scan Directory: D:\home\mywebsite.com\wp/wp-content/uploads\

    Whenever I import media (mainly video files), it keeps the trailing backslash in the URL thus causing an incorrectly formatted URL reference.

    Can this be fixed? My workaround has been to go into the MySQL DB and manually change which way the slash faces. I’m doing it directly in the DB since I have hundreds of files to deal with. Thanks for your time and attention in this matter!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author erolsk8

    (@erolsk8)

    Hi @veriatech, that seems bad. But this plugin uses DIRECTORY_SEPARATOR on all the places for this reason (so that it’s \ on Windows and otherwise /). But I just realized WordPress functions (used by this plugin) force the use of /:
    https://developer.wordpress.org/reference/functions/get_home_path/
    https://developer.wordpress.org/reference/functions/get_site_url/

    So maybe this plugin should always use / as well. But I’m not sure if that will work on the Windows server.

    Also, which database field are you editing? Because if it’s a URL, that’s a different story and should always be / regardless of server.

    Plugin Author erolsk8

    (@erolsk8)

    Hey @veriatech, I did a small change and pushed it with a new 1.1.4 version. Can you please try it out to see if it works on Windows Server now?

    Thank you

    Erol

    Wow! You are amazing, Erol! Thank you for the quick response and turnaround with a new version! I will get it downloaded, give it a try and report back here shortly. Thanks so much!

    FYI, I was editing the wp_postmeta table and the meta_value field using MySQL Workbench. I’m a DBA so I’ve very familiar with editing data directly in DBs.

    Thanks again Erol and I will let you know!

    Dennis @ Veria Tech / Veria Video

    Hello Erol,

    Still no joy. I updated to the latest plugin (1.1.4) and still get the same result. However, my Scan Directory now reports itself as:

    \wp-content/uploads\

    and the entry in the DB gets populated as:

    D:\home\mywebsite.com.com\wp/wp-content/uploads\myvideo.m4v

    Oddly enough, the ONLY slash that I have to correct in the DB field is the trailing slash just after “uploads”. Once I make that one change, all is good. I wonder if you could leave off the trailing slash and see if that works?

    Thanks so much for your help!

    I was also reading this article, Erol. It seems to be a gray area at best.

    https://cmljnelson.blog/2018/07/26/which-way-do-your-slashes-face/

    Plugin Author erolsk8

    (@erolsk8)

    Oh too bad, but thanks for the details! I’ll take a closer look tomorrow.
    Problem is that I can’t actually test it on Windows, but with your help, I hope we can solve it 🙂

    But when you’re editing wp_postmeta.meta_value do you get full path there? With D:\home\...myvideo.m4v and all that?
    Because that field should just have ”end” of the path, so for example just ”myvideo.m4v”.

    Also, it would help to know which path you get on initial plugin screen, before you click ”Scan Files”. There is also full path if you hover over that highlighted part.

    Thanks

    Thank you Erol! Yes, I get the FULL path in the meta_value field, not just the .m4v file.

    Also, here is what the initial plugin screen shows before I click “Scan Files”

    “Use this to see content of upload dir: \wp-content/uploads and import files to Media Library.”

    Hope that helps! Let me know anything you need at all to help! Thanks again!

    Plugin Author erolsk8

    (@erolsk8)

    Hey @veriatech, the more I read about this, the more it became obvious I should always use forward slashes. That’s what WordPress does and PHP on Windows Server shouldn’t have a problem with that.

    I pushed it to 1.1.5 version, so could you please try it out?

    Thanks

    Erol

    Boom! That did the trick, Erol. It works like a charm now! I cannot thank you enough. Thank you so much for a great plugin and your great support! Keep up the great work!

    Plugin Author erolsk8

    (@erolsk8)

    Great! I’m so glad to hear that. And it wouldn’t be possible without great insight from your end, so thank you!

    Absolutely, Erol! Anytime! I know I am in the minority running WordPress on a Windows Server, but, that’s just what I have to do because I am currently hosting websites for customers (including my own websites) across multiple CMS platforms, mainly DNN (DotNetNuke) and now WordPress. I am slowly but surely getting up to speed with WordPress and may be spinning up a Linux server soon just to host the WordPress sites. I am mainly a DBA on the Microsoft side of the world managing Enterprise scale DBs but I do have some coding experience as well which is why I am not totally oblivious to what goes on behind the scenes with the frameworks required to make these websites work! If you need any help at all testing anything for a Windows Server hosted WordPress site, please do not hesitate to look me up! Thanks again for your great plugin and support! I’m starting up a video site for the dance industry uploading hundreds of videos several GB in size each and uploading outside of the WP site is critical, thus comes the usefulness of your plugin syncing the files with the WP install! Great work, Erol! Bravo! Keep it up!

    Plugin Author erolsk8

    (@erolsk8)

    Wow, it’s great hearing all of this 🙂

    Thank you, and I wish you good luck with your future endeavors.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.