Advertisement:

Author Topic: bug in detect_path or in use of detect_path with certain server configurations  (Read 9567 times)

Offline bugstomper

  • Semi-Newbie
  • *
  • Posts: 17
This bug is in both 1.x and 2.0rc5. I'm maintaining a site where the ISP put the server's document root in /var/www/vhosts/example.com/httdocs and SMF is installed in directory forum under that. The ftp daemon is configured to chroot the owner userid of the files to directory /var/www/vhosts/example.com. The detect_path function guesses a root path of /var/www and so the Packages File Permissions dialog (the form for the ftp settings) suggests the incorrect path of /vhosts/example.com/httdocs/forum.

It is not a bug that detect_path guesses wrong, given the nonstandard layout that begins with /var/www. What is wrong is that when I enter the correct path in the form, what I enter is stored in the settings table of the data base, but after that the ftp settings form reverts to the incorrect guess of detect_path instead of showing the stored value from settings.

I propose as a fix that detect_path check isset($modSettings['package_path']) early in the routine and if it is set then return using the value in $modSettings['package_path'] instead of trying to guess the path. This will allow the user to decide whether to override the guess which will take care of any unusual circumstance that makes the guess be wrong.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
I think it makes sense: if the correct location is known, why SMF needs to guess it (again)?


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Last bump of the nigh, just to remember it...not very effective I know... :P


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline NanoSector

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 10,496
  • Gender: Male
  • VC321xb47@aperture:~#
    • Yoshi2889 on GitHub
I think it makes sense: if the correct location is known, why SMF needs to guess it (again)?
Because not everyone takes time to remember their paths and are just like "Oh meh that'll be okay..."
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."