I work on some custom multi-site installations where users are allowed to sign up for their own web site. In the couse of that I have found that I needed to set up different install profiles for different levels of services/features. One of the things that I have made changes to is the install.php in version 6.x so that the install profile can be set from the settings.php using $conf['install_profile'], there by eliminating a users chance to choose a profile when they are installing their site. It really only requires a few lines of code and I think this could be a great addition to core, as many other items are allowed to be set in the settings.php. Why not the install profile?
original install.php Lines 94-103(7.x) or 77-86(6.x)
// Decide which profile to use.
if (!empty($_GET['profile'])) {
$profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
}
elseif ($profile = install_select_profile()) {
install_goto("install.php?profile=$profile");
}
else {
install_no_profile_error();
}
New install.php lines 94-106(7.x) or 77-89(6.x)
// Decide which profile to use.
if (!empty($conf['install_profile']) ) {
$profile = preg_replace('/[^a-zA-Z_0-9]/', '', $conf['install_profile']);
}
elseif (!empty($_GET['profile']) ) {
$profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
}
elseif ($profile = install_select_profile()) {
install_goto("install.php?profile=$profile");
}
else {
install_no_profile_error();
}
You would then simply set your settings.php with
$conf['install_profile'] = "my_install_profile_of_choice";
Hopefully this is a good idea and others would think so to.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | install.patch | 523 bytes | arcaneadam |
Comments
Comment #1
arcaneadam commentedI created the patch.
Comment #2
arcaneadam commentedComment #3
shrop commented+1
Great idea!
Comment #4
arcaneadam commentedComment #5
webchickLet's get this actually reviewed. :) +1 doesn't cut it. how to review patches
I'm not sure I like co-opting the $conf array for this. $conf is traditionally strictly for stuff in the variables table.
Comment #6
catchI think I can see a possible future situation where we want to know which install profile was used to install Drupal, and setting a variable might work for that. I think it'd be worse to introduce a new global just for this setting, so bumping back to rtbc.
Comment #7
dries commentedWe'll want to document this better.
When there is only one install profile, the screen will also disappear. Hence, a possible alternative solution is to remove the other install profiles from disk.
Comment #8
arcaneadam commentedIn doing some work with this I have noticed that there is a problem that can arise if someone inserts a non existent profile into the $conf['install_profile'] OR if they manually type one in to the query string(which IMHO is a problem with the core files)
I am trying to think of a good solution to this issue not just with setting the profile in the settings.php but with providing some sort of message in general if the selected profile can't be loaded and then allowing users to select from a available one.
Comment #9
sun.core commentedComment #10
valthebaldExisting 'exclusive' parameter in install_profile_info() make this addition only useful in a case when you need different default profile for different sites of multi-site install.
Comment #11
alexpottThis is a duplicate of #1351352: Distribution installation profiles are no longer able to override the early installer screens