On Fri, 03 Apr 2009 16:05:24 +0000 Earnie Boyd earnie@users.sourceforge.net wrote:
Crontab comes to mind using wget similar to cron.php.
Yep you're right... if I've dev and prod sites and: - I want to svn without worries... I can't save stuf related to the environment in drupal cfg - on the other hand the difference of environment is going to be the server name
meanwhile I ran into other problems... and I'm thinking at what chx was proposing about sqlite.
Somehow drupal configuration and environment is not that definite.
You can't just eg. put it in a complex object, save it somewhere and substitute it with another one.
What I mean... you can't eg. bootstrap, save the configuration somewhere, change db connection, re-bootstrap, save the configuration in some other place... and then re-bootstrap and load a "personality" on the fly.
As a concrete example I tried to build up a minimum static "configuration" to run my scripts on a multisite.
Everything was working till I had to switch the theme.
Here I'm on D5.
Switching a theme on the fly doesn't look even possible. Functions to load the theme dynamically include files and the naming conventions let people give clashing names in the themes so you end up in "function already defined" errors. Fortunately I can move part of the code I really need somewhere else but then I'll have to write some logic that decide which function to call according to a configuration parameter that's going to be a drupal variable that will introduce a dependency on the DB connection. One way would be to make templates classes, they could still dynamically include code but you could have several instances and shelter them in a namespace. Even the configuration could fit in a class, with a constructor that get a DB connection, so 2 configurations may share a connection, you could run the drupal code base switching between 2 configuration dynamically etc...
Or perhaps a master control Drupal instance where the $db_url is an array of each sites DB. Then you can run your foreach specifying each DB with db_set_active.
I know my situation is peculiar and I'm actually "scratching my own itch" but if you're sharing the DB across a multisite it's a pain to change connection. The theme system is actually a "good" example. If you've some complicated logic you'd like to simply switch and you don't want to play the glue game by yourself call_user_func($somestuff .'_somepostfix', $args); themes are a good candidate to change logic with just one switch... and by chance... I was actually dealing with some sort of theming... just not "directed" to the browser... but to xml.
So I'm thinking to play the glue game or maybe put this stuff in a class and create 2 instances.