Hey there,
I tried to install FC 7.2.8 in a subdirectory of the webroot (like discussed here) but when trying to access the webtop, the webtop/application.cfc
function getProjectConstructorLocation()
always redirects to the install directory.
I need to install multiple FarCry instances on one server (currently a Mac w/ 10.12, Apache, CF 11, and MySQL 5.x), and they need to work with different cores as well. So, what I want is basically:
/sites/appA – /appA [1]
/sites/appA/core
/sites/appA/core/webtop – /webtop-appA [2]
/sites/appA/plugins
/sites/appA/projects/fcappA
/sites/appA/projects/fcAppA/www – /fcAppA [3]
/sites/appB – /appB [4]
/sites/appB/core
/sites/appB/core/webtop – /webtop-appB
/sites/appB/plugins
/sites/appB/projects/fcappB
/sites/appB/projects/fcAppB/www – /fcAppB
[1] This is the usual “/farcry” mapping. I changed it because the two sites need to have different mappings on one server. In order to make it work, I replaced all occurrences of “/farcry/core,” “/farcry/plugins,” “farcry.core,” and “farcry.plugins” with “/appA/core,” etc. (Dreamweaver is a great tool for this ) I did this with an old 4.X installation – works.
[2] The mapping to the site’s Webtop application. These two need to be different in order to coexist on one server.
[3] The mapping to the site root for “appA.”
[4] The “farcry” mapping for the second installation, as mentioned by Justin Carter in the above linked thread.
Since the non-webroot install as described in the already mentioned post did not work, I installed in the webroot (/sites) and copied/moved the underlying files and directories according to the above displayed structure. I moved everything outside the original “/farcry” directory to the “/fcAppA” folder.
Now, when I try to call the webtop application with the URl http://127.0.0.1/webtop-AppA, I get redirected to the installer because of the function getProjectConstructorLocation()
in webtop/application.cfc
:
<cfset var loc = "" />
<cfset var virtualDirectory = "" />
<!--- strip the context path first (for J2EE deployments) --->
<cfset var script_path = right( cgi.SCRIPT_NAME, len( cgi.SCRIPT_NAME ) - len( cgi.context_path ) )>
<!--- Get the first directory after the url if there is one (ie. if its just index.cfm then we know we are just under the webroot) --->
<cfif listLen(script_path, "/") GT 1>
<cfset virtualDirectory = listFirst(script_path, "/") />
<!--- If the first directory name is the same name as the plugin, then we assume we are running the project from the webroot --->
<cfif virtualDirectory EQ arguments.plugin>
<cfset virtualDirectory = "" />
</cfif>
</cfif>
<!--- If we ended up with a virtual directory we check to see if there is a farcryConstructor --->
<cfif len(virtualDirectory) AND fileExists(expandPath("/#virtualDirectory#/farcryConstructor.#arguments.fileExtension#"))>
<cfset loc = trim("/#virtualDirectory#/farcryConstructor.#arguments.fileExtension#") />
<cfelseif fileExists(expandPath("/farcryConstructor.#arguments.fileExtension#"))>
<!--- Otherwise we check in the webroot --->
<cfset loc = trim("/farcryConstructor.#arguments.fileExtension#") />
<cfelse>
<!--- If all else fails... --->
<!--- 1. See if the user has a cookie telling us what project to look at. --->
<cfif structKeyExists(url, "farcryProject") AND len(url.farcryProject)>
The reason is that the variable virtualDirectory holds the value of the webtop mapping, in our example “webtop-AppA”. Now, there is no farcryConstructor.cfm
script in that directory. Thus, the script tries the webroot directory, but since I need to run multiple FarCry installations, the web root directory doesn’t contain a farcryConstructor.cfm
script either.
And since the webtop application doesn’t know anything about the “front-end” site either, there are no cookies or any information which joins those two.
So, long story short: How will this be done? Which step did I miss?
Any pointers are greatly appreciated.
Thanks,
Thomas