twhite3000 / vqmod

Automatically exported from code.google.com/p/vqmod
0 stars 0 forks source link

vQmod doesn't work for symlink-based multiple stores in OpenCart #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create symlink pointing to an OpenCart installation directory
2. Create store, setup its URL to http://{hostname}/{symlink}/
3. Visit http://{hostname}/{symlink}/

What is the expected output? What do you see instead?
I expect to see OpenCart core files modified by vQmod. I see them untouched.

vQmod Version: any
Server Operating System: any

Please provide any additional information below.
Possible fix: replace new VQMod() with new VQMod(DIR_SYSTEM . '/..') in vQmod 
installer for OpenCart.

Original issue reported on code.google.com by xeml...@gmail.com on 28 Dec 2011 at 9:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Can you provide actual path's (editing out sensitive data but still showing the 
relevant paths). The path (both the one you pass and the current vQmod path) is 
passed through realpath to resolve the sym links by default, therefore if it's 
not working them out, then it sounds like
A) there's an issue with the symlink or
B) realpath isn't working on your system for some reason
C) The directory containing the vQmod directory isn't resolving for some reason

As you've pointed out, the path variable can be passed to the class, however 
vQmod isn't intended JUST for OpenCart so this "fix" would only help for an 
opencart install, and considering this is the first report of the bug, it's 
likely to be your system that is causing it

Original comment by DJG6...@gmail.com on 28 Dec 2011 at 5:54

GoogleCodeExporter commented 9 years ago
Here they are.

On my test machine I'm using Windows 7 + HardLinkShellExt. My main store is 
located at http://localhost/oc1, the second store at http://localhost/oc2. oc2 
is an NTFS junction pointing to oc1 directory.

$vqmod->modCheck() resolves startup.php path in oc1 store to: 
C:\ServerRoot\oc1\vqmod\vqcache\vq2-system_startup.php, whereas in oc2 store 
to: C:\ServerRoot\oc1\system\startup.php.

$vqmod->_cwd is set in constructor to E:\ServerRoot\oc1 and E:\ServerRoot\oc2 
for oc1 and oc2 stores respectively.

The problem lies in the following line of modCheck() method:

$stripped_filename = preg_replace('~^' . preg_quote($this->getCwd(), '~') . 
'~', '', $sourcePath);

$sourcePath uses DIR_SYSTEM taken from config.php, but $vqmod->_cwd does not. 
OpenCart's root path when not given explicitly is set automatically to 
dirname(dirname(__FILE__)).

That's why setting vqmod path to DIR_SYSTEM . '/..' fixes the problem.

Original comment by xeml...@gmail.com on 28 Dec 2011 at 6:24

GoogleCodeExporter commented 9 years ago
This sounds to me like it's not understanding the symlink in realpath. Where is 
HardLinkShellExt from and is it that that creates these sym links? If so, then 
it's going to be down to that that it's not resolving them correctly, since 
php's realpath will not be able to handle it

Original comment by DJG6...@gmail.com on 28 Dec 2011 at 9:13

GoogleCodeExporter commented 9 years ago
HardlinkShellExt is a nice tool that, among others, can create symlinks (or 
junctions as they are called when directories are involved) under NTFS.

Yes you're right, PHP's realpath() in Windows cannot resolve NTFS symlinks. 
That's a shame.

Original comment by xeml...@gmail.com on 29 Dec 2011 at 12:17

GoogleCodeExporter commented 9 years ago

Original comment by DJG6...@gmail.com on 29 Dec 2011 at 3:33