Cloning site A to site B should establish a "has clone" relationship from A to B (which also implies a "is clone of" relationship from B to A, ie. that the relation is reflexive). For this, we need to implement site relationships, which is a fairly simple lookup table with a "type" column. I think that the table should be kept generic enough so we can create new relationships in the future, but for starter, this is to track site clones from masters, as described in #669304: Multiple environments per site.

CommentFileSizeAuthor
#4 relationship.png16.77 KBmig5

Comments

Anonymous’s picture

What do you think of

+-----+-----+--------+
| nid | rid |  type  |
+-----+-----+--------+
|  42 |  3  |  clone |
+-----+-----+--------+

Where nid = the site, rid = the nid of the 'parent' or 'related' site, and 'type' being what made the relationship (which would simply be the $task type.

Then we could do various sorts of mapping in Hosting so that it would display sensible information in the hook_view(), similar to how we map the site status from integers to proper wordings in hosting_site

You'd then be able to query this table via the appropriate API hook to determine whether to override the 'site already exists' restrictions.

Perhaps also a configurable setting in Clone along the lines of 'Allow cloned sites to be overwritten?' or something would be nice too.

Edit: sorry some of the above should've been posted to #699922: multiple clone support.

anarcat’s picture

So yeah, that's basically the structure I had in mind. Feel free to start hacking at that if you feel like it. I wonder if there are existing modules that already do exactly that...

Anonymous’s picture

http://drupal.org/project/noderelationships

We'd need to add CCK (and nodereference) and Views as dependencies, we have modalframe and jquery_ui already

Maybe nodereference would be enough already but not sure if we want to drag CCK into Aegir

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new16.77 KB

Initial dev branch has been pushed to g.a.o.

This is early days and entirely frontend. Features:

1) Tried to add as many API functions as I could think of that might be useful for future abstraction
2) Clone implements one of these functions to add a relationship between two sites in the drush post_ task
3) Site nodes have a MENU_LOCAL_TASK called 'Relationships' consisting of a table showing all existing relationships, making a distinction between where a site holds a 'parent' or 'child' relationship of the other. (i.e if Site B is a clone of Site A, Site A is thus the parent in the relationship). Screenshot attached

I added a _settings hook to Clone that simply provides a way to turn 'Overwrite' on or off, based on whether one should be able to overwrite a previous clone of the same name. But no logic to actually handle this exists in the backend yet. The clone form's hook_validate will need to check for this setting before complaining of a URL that already exists, and the backend will need to perform a provision-delete on a site before being able to restore from a tarball if the platform is the same target as the previous edition of the clone's.

adrian’s picture

Status: Needs review » Needs work

this doesn't have any interface for specifying the relationships as of yet.

I think we need to make the relationships meaninful to our users, for instance being able to say this site is the "live" or "qa" clone of a specific site, versus just saying it's cloned.

steven jones’s picture

This may come about as a way to groups sites together so that you can know that one is the staging site of another etc, or that a certain platform is related to this other platform.

But, this really needs fields to shine, possibly relation module in D7, there's literally no point in adding our own DB tables these days.

I'm going to mark this as won't fix, mainly to clean up the issue queue. I think that something highly similar to what has been suggested here will get into the D7/8 version of Hostmaster though.

steven jones’s picture

Status: Needs work » Closed (won't fix)