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.

CommentFileSizeAuthor
#1 install.patch523 bytesarcaneadam

Comments

arcaneadam’s picture

Title: Allow Install Profile to be set in settings.php » Created the patch
Status: Active » Needs review
StatusFileSize
new523 bytes

I created the patch.

arcaneadam’s picture

Title: Created the patch » Allow Install Profile to be set in settings.php
shrop’s picture

+1

Great idea!

arcaneadam’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Needs review

Let'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.

catch’s picture

Status: Needs review » Reviewed & tested by the community

I 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.

dries’s picture

Status: Reviewed & tested by the community » Needs work

We'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.

arcaneadam’s picture

In 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.

sun.core’s picture

Version: 7.x-dev » 8.x-dev
valthebald’s picture

Existing '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.

alexpott’s picture