On Apr 8, 2006, at 12:42, stv wrote:
> I would like to use Subversion to manage both the production & staging
> servers for a website (for which I have only FTP access). There are
> two areas of particular interest for me, but I imagine this is a more
> generic problem. Personally, I want to change one line in a CSS file
> and three lines in a db-config file so that my staging site has a
> strong visual cue and uses a staging database. I imagine that a
> traditionally installed application with localizations for various
> sites may have similar needs.
[snip]
> Basically, I think I'm looking for #IFDEF ( ... if I got that right,
> my C days are getting hazy)
That's how we do it. We leave Subversion out of it completely. No
need to have a separate branch if all that's ever going to be
different is these few changes. Much less hassle to keep it all in
one branch and use your programming language to conditionalize this
stuff. Our DB connection script says something like:
<?php
if (IS_STAGING_SYSTEM) {
define('DB_NAME', 'staging_system');
} else {
define('DB_NAME', 'live_system');
}
?>
and the HTML file has something like:
<?php if (IS_STAGING_SYSTEM): ?>
<link rel="stylesheet" type="text/css" href="staging_extras.css" />
<?php endif; ?>
How you define the IS_STAGING_SYSTEM constant is up to you; we do it
by hostname.
<?php
define('IS_STAGING_SYSTEM', 'stage.example.com' == $_SERVER
['HTTP_HOST']);
?>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Apr 8 13:49:56 2006