Removing getProfileString from Galleon

I'm working on a small personal project at the moment and didnt want to pay out on hosting which i've just realised has been a bad idea! Why? because I cannot use get & set profileString. Now this isn't usually a problem as I never use them but Galleon does to read the ini file.

Luckily the solution has been easy to resolve. In the galleon.cfc I edited the getSetting() method and for now hard coded in the struct. My method now looks like:

view plain print about
1<cffunction name="getSettings" access="public" returnType="struct" output="false"
2            hint="Returns application settings as a structure.">

3
4    <cfset var r = structNew()>
5    
6    <cfscript>
7        r['dsn'] = "myDSN";
8        r['perpage'] = "20";
9        r['fromAddress'] = "admin@myDomain.net";
10        r['rootURL'] = "http://myDomain.net/forums/";
11
        r['
sendonpost'] = "admin@myDomain.net";
12        r['
dbtype'] = "mysql";
13        r['
tableprefix'] = "galleon_";
14        r['
version'] = "1.7.006";
15        r['
requireconfirmation'] = "true";
16        r['
title'] = "LAYL Forums";
17        r['
fullemails'] = "true";
18        r['
encryptpasswords'] = "false";
19        r['
allowgravatars'] = "true";
20        r['
safeExtensions'] = "zip,tar,jpg,gif,png,wpd,doc,pdf,xls,ppt,txt,odt";
21    </cfscript>
22
23    
24    <cfreturn r>
25    
26</cffunction>

Hopefully in the future I'll change Rays ini file for an XML one and refactor getSettings()

Posted: 24-Nov-2006

View: 1360

Permalink: here

Comments

That's what I was doing on BlogCFC. The last version of my blog wasn't using the ini file.

The only problem is that it's less elegant as you have to change everything on the code instead of having that fancy page for configuration, but works indeed.

Cheers

Marcos

#1 Marcos Placona
24/Nov/06 9:55 AM

It was funny 2 days after speaking to you I hit the same problem! Like you said you do loose some of the admin functionality but im stuck at the moment on a cheap host of another couple of months.

#2 Andy J
24/Nov/06 10:10 AM

I can't speak for Galleon, but with BlogCFC you can pass in a struct to the init function in Application.cfm. This overrides the blog.ini.cfm, so you don't end up using getProfileString.

However, it does mean that you can't change any settings via the settings section in the admin as, obviously, the struct is hardcoded and any restart will override any changes to settings made online.

It should be pretty easy to extend BlogCFC (rather than change) to use this functionality rather than ini file stuff...

#3 Stephen Moretti
24/Nov/06 10:45 AM