Over the weekend I installed FarCry on a Linux box. Unfortunately it took a bit of surgery to make it happen. Seems to me that there are a couple of decisions that have to be made to accomodate the the case sensitivity and filesystem layout of the Unux / Linux platform, and also to work around some bugs in CFMX on Linux (presumably also on Solaris).
Also having installed it doesn't mean it actually works :D So far I've only fixed the site default page, and a couple of pages in the admin. I still can't edit any of the content or manage users or do much else yet. It would probably take another weekend's worth of work to make everything work.
Anyway, here's how I went about the install:
The environment used was my laptop, Pentium 4 running the testing version of Debian GNU/Linux (sarge) with several unstable packages added.
- FarCry build: b127 - Web server: Apache 1.3.27 - Database: MySQL Ver 4.0.13 - ColdFusion: CFMX for Linux with Updater 3 installed - webroot: /var/www/html -- this is the default on Redhat, while Debian defaults to /var/www. I changed it to accomodate the applications directory under /var/www as well. - farcry applications dir: /var/www/applications
- ColdFusion mappings:
/ /var/www/html /farcry /var/www/applications
Ok, on to the install... I tried to be as unintrusive as possible, but unfortunately some changes in were unavoidable. Some of these changes were necessiated by bugs in CFMX that cascaded onwards to cause other problems.
I should add that I didn't exactly make my life easier while I was doing the porting. Not only I was working with a case-sensitive file system but with a case sensitive web server and a database that treated table names as case-sensitive. I'm pretty sure that both Apache and MySQL can be made to work case-insensitive, but fixing the code rather than changing the configuration would make FarCry easier to install.
The problems I ran into:
* Permissions *
I had to make sure that the account ColdFusion runs under (eg www-data or similar) has full permissions to the install directories, either by executing chown -R <cfmx_user>:<cfmx_group> * or chmod -R 777 * from the webroot. Alternately it's sufficient to have write permission to the application directory and application directory/www only, so files can be created / copied during the install. This means that the install will crash at the end when trying to delete farcry_app, but this is easy to fix and it also makes reinstalling easier :)
* Forward slash vs. backslash in local paths *
I've read it somewhere in the CFMX docs (or heard it from someone) that the JRE doesn't discriminate between / and \. As far as I could tell, this is only true on Windows platforms, where '/' has no special meaning. On UNIX / Linux however, forward slashes denote directories and backslashes are used for escaping special characters (eg spaces) in the path. When I experimented with porting another application before, I've found that the best cross-platform solution is to delimit all local paths by forward slashes. This also makes it easier to convert between local paths and relative paths. In order to make this actually work, everywhere a path is created or appended, '/' should be used instead of '\'.
To convert local paths that are returned by ColdFusion's native tags and functions, there are two possible solutions. One would be to make a couple of 'cross-platform' sytem functions (eg: XPgetCurrentTemplateName(), XPgetDirectoryFromPath(), <cf_XPDirectory>) that would be the equivalent of getCurrentTemplateName(), etc except they would always return forward slashes. The other approach would be to code all Find, REFind, Replace, etc operations on paths work both with '/' and '\'.
So according to the above, this line...: projectPath = replaceNoCase(getCurrentTemplatePath(), "\farcry_core\admin\install\index.cfm", "") & "\farcry_app";
...will have to be changed to either...:
projectPath = replaceNoCase(XPgetCurrentTemplatePath(), "/farcry_core/admin/install/index.cfm", "") & "/farcry_app";
...or: projectPath = REReplaceNoCase(getCurrentTemplatePath(), "[/\\]farcry_core[/\\]admin[/\\]install[/\\]index.cfm", "") & "/farcry_app";
This is assuming that RedSky won't bring considerable changes to the way Unix paths are treated.
* Case sensitivity *
There's a bug in the CreateObject function where it would automatically lowercase the object name and then subsequently fail to find any CFCs that contain upper case letters in their name. As I have no idea if this will be fixed in RedSky or not (and because I'm impatient) I lowercased all the CFC names (eg. dmHTML, dmNews, etc).
The same problem occurs with custom tag names when called using the <cf_customTagName> syntax so I replaced all of these with <cfmodule template="customTagName.cfm">.
There were a couple of problems due to ColdFusion files referenced using the wrong case. The bigger problem is that table names in mysql are case sensitive by default when ran on an UNIX platform. This behaviour can be turned off but IMHO it is better practice to fix the code, so this was the approach I took. Fortunately I only had to lowercase a couple of table names (notably all the ones beginning with dm that are also names of CFCs).
Anyway, having made a whole bunch of changes, this brings me to the question of what should I do with them. Who should I send the changes and in what format? Would you prefer a patch usable by the GNU patch utility, or a zipped version of the entire modified Farcry release? I suppose you guys could have a look at the changes anyway and decide if it's worth merging them.
I haven't had the chance to test my modifications on a Windows server yet, so they could have adverse side-effects ranging from random crashes / misbehaviour to meltdown of the CPU core, tidal waves and locust infestation :D
Regards, Viktor Radnai Web Developer Ernst & Young, Sydney
--- You are currently subscribed to farcry-dev as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED]
