:-}
On creation, almost everything seems to work, but I get a "Page not found" and a ridiculous URL
http://{druplethost}/?q=/var/www/{druplethost}/sites/{newdruplet}.{druplethost}
(my substitutions, that's not the ridiculous part. The /var/www is the problem.
Looking at druplet_generate_site() it's clear that a node is being created that is setting $node->path to something totally different to what Drupal thinks 'path' means.
While there is a chance that this would have worked anyway. ... It doesn't. Possibly because of the leading /
Anyway. It's not right.
I propose the druplet site filepath as stored in the node be relabelled to $node->druplet_sitepath (or something) to clarify the modules namespace.
In fact, as a best-practice, the custom fields could all be more clearly labelled, or packed into a
$node->druplet['host'];
$node->druplet['subdomain'],
$node->druplet['domain'],
$node->druplet['path']
$node->druplet['db_name']
$node->druplet['db_user']
$node->druplet['db_password']
sort of array. Just to be tidy and avoid conflicts.
Best-practice, but not strictly neccessary.
... actually, looking at the code more, half those attributes are only temporary, so the impact is lots less than I thought.
What do you think?
For now, I'll be renaming the 'path' away anyway.
I'm doing a bit of hacking, so I won't have a clean patch. I'm also looking at ways of inserting more parameters from the creation form to pass them to the install profile - to customize the build still further.
EG, CCK fields added to the druplet content type become (global?) variables that my .profile can read and do still more self-customization. or the $node object itself is just passed in.
... that's another thread.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | druplet-robustness_deletion_and_prefixes-20081205.patch | 19.5 KB | dman |
| #1 | druplet-robustness_and_deletion-20081205.patch | 6.74 KB | dman |
Comments
Comment #1
dman commentedHere is a patch that
- fixes the path conflict
- is more paranoid about things going wrong - it stops barging ahead when there is a fatal error that needs fixing, AND can sorta continue making a site once the permissions or whatever are fixed
- Also DELETES an entire druplet when you press delete (this may need an extra option if the behaviour is not wanted)
- Fixes what looks like a typo mistake where the db username was not being used - it was the db name instead. It still worked, but was incorrect according to the intent of the code.
The patch is sorta significant, but it's only HALF the changes I've tried already. I've also got full support for prefixes - as I REALLY don't want my php user to be able to create/drop databases and my sandboxes are just fine all in one prefixed bag.
I'll roll and patch that change also, but thought I'd post the first half for review anyway before the changes got too radical.
Comment #2
dman commentedHere is a CUMULATIVE patch including the above and also PREFIX support so we can make heaps of sandboxes without needing greater DB access.
It's big, so sorry, but it's all getting better. Much better.
Next is probably extra fields which I'll turn into variable_set calls on the target! Cool functionality.