Problems with different DOCUMENT_ROOTs and a static JS config file
We are currently using a setup where many sites are sharing the same source via symlinked index.php files. However, they use local image directories that we want filemanager to access and manage. For all the assets though, we are using apache alias to redirect all asset URLs since they are not local to the site's public_html. This means that filemanager's PHP scripts have a different DOCUMENT_ROOT than the site's index.php which became problematic when trying to get the right filepaths.
The other issue is that each site's URL and file path are different so I could not hard code them into the JS config file. I tried every combination I could think of with serverRoot, fileDir, and baseUrl but had issues no matter what. Either the files could not be found, the inserted image was relative, or the inserted image had the incorrect path due to the different document roots.
To get it to work, I ended up hacking filemanager.js to always force baseUrl from window.location (rather than the config as again, I have to be able to dynamically set the baseUrl as it differs on each server and/or site). I then had to change setFileRoot to accept a second parameter of a custom document root that is used instead of $_SERVER['DOCUMENT_ROOT']. With those two hacks, I was able to get it to work with my setup.
I think most of my issues could have been worked out if I could have more control over the config values server side rather than a static js file. Wondering how distributable apps with different setups handle this as well? Developers won't want their users to have to manually manipulate a JS file to get it to work. Anyway, any thoughts on a better way to handle this? Or am I totally missing something and could have gotten it to work if I knew what I as doing :-)
Thanks! Alan
Thanks for reporting. Well, I'm not sure I understand 100 % of the purpose but this appears to me as very specific user case. Unfortunately I will not be able to test it since I don't have much time.
And I just wonder if using setFileRoot() with following js settings is not enough :
"serverRoot": false,
"fileRoot": "/",
You probably already tried. Maybe, it list correctly files but does not provide the right URL on select. Just tell me ?