Page 1 of 1

Saving Configuration to a Different File?

Posted: Fri Oct 14, 2005 2:09 am
by Narcissus
Like most people (I'm guessing) I have a local copy of my website that I work on. I have set up my hosts file to redirect to my local copy so that it has the same directory structure as my remote server, but without affecting what else I have running on localhost. It also allows me to add and without any fear of them 'crossing' over.

When I'm ready to make a change to my remote server, I just upload the whole local copy and it continues to work.

Now here's the thing: the way this works is that for each of my web applications that have a configuration file, I have tweaked this file so that it will include one or another actual configuration file, depending on whether it's running on my local copy or not. Normally the way I would do this is (using configuration.php as an example configuration file name):
1) make a copy of configuration.php for my local copy. Call it local.configuration.php
2) make a copy of configuration.php for my remote copy. Call it remote.configuration.php
3) create a new configuration.php file with logic that basically says:
if (running on local server) {
} else {

This works a treat. However when I go to edit the configuration in the Joomla! GUI, it writes straight over configuration.php.

Is anyone else having the same problem? Does this seem to be an issue that should be fixed in the main code branch? I don't particularly want to have to use OpenSEF for this mainly because I see it as overkill for the issue, but also because it then becomes reliant on Apache.

It shouldn't be too hard at all to fix entirely from within the GUI.

Step One would be moving my logic into a function that gets called:
a) when going to read the configuration file; and
b) when going to write the configuration file.

At this point, users can edit that function if they feel they need the functionality.

Step Two would involve adding another bit of admin GUI that would write that function for you, basically.

No doubt I'll implement this functionality as soon as I get time but I was wondering:
a) has anyone done this already?
b) would anyone use this if it were done?
c) if it were done, would it possibly be accepted into the main code branch?


Re: Saving Configuration to a Different File?

Posted: Fri Oct 27, 2006 1:37 am
by JSalvador
Hi all,

This the type of solution that I'm looking for...
I would like to have three sites running off of the same file structure and database.  The only difference I would need would be differences in configuration.php and components/content.html.php... then be able to use a different template for each site.  Is this attainable?

Re: Saving Configuration to a Different File?

Posted: Fri Oct 27, 2006 1:38 am
by JSalvador
Sorry this was posted in the wrong thread i was looking for this one on multisites: