Right now profilename_install() is pretty worthless. Mostly all you can do is direct database action, but since we have a great API and programmatic submission of forms in 5.x we need a full bootstrap to allow profiles to add sample data, create users/roles, change config options, etc. So we should allow a full bootstrap in profilename_install() or profilename_enable() so installation profiles can do fun stuff. Currently, you have to enable an auxiliary module and then do a drupal_goto() in profilename_install().

What you have to do now:

// $Id: $

/**
 * Implementation of hook_profile_modules().
 * 
 * Return an array of the modules to be enabled when this profile is installed.
 *
 * @return
 *  An array of modules to be enabled.
 */
function my_site_profile_modules() {
  $modules = array('aggregator', 'block', 'blog', 'color', 'comment', 'contact', 'filter', 'forum', 'help', 'menu', 'node', 'path', 'system', 'taxonomy', 'upload', 'user', 'watchdog', // Core modules.
    'adsense', 'gsitemap', 'pathauto', 'views', 'views_rss', 'views_ui', // My Site modules.
    'devel', // Other modules.
    'my_site_setup',
  );

  return $modules;
}

/**
 * Implementation of hook_profile_details().
 * 
 * Return a description of the profile.
 */
function my_site_profile_details() {
  return array(
    'name' => 'My Sites',
    'description' => 'Select this profile to enable some basic site functionality and the default theme.',
  );
}

/**
 * Implementation of hook_install().
 */
function my_site_install() {
  // This callback has all the drupal_execute goodness. It would be nice to 
  // have profile_install() be like a normal callback so we could show a form and/or config away!
  drupal_goto('my_site_setup_configure'); 
}

Comments

RobRoy’s picture

Version: 6.x-dev » 5.x-dev
Category: feature » task
Status: Active » Closed (works as designed)

Looks like I missed some stuff. I did a little searching and looks like I was missing out on a profile hook_profile_final.

install_complete() calls profilename_profile_final() after a drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL) so this should be the place to do all this magic. After I mess around with this a bit more I'm gonna go document this at http://drupal.org/node/67921 and try and explain what should go in profilename_install (still have to figure out why this is useful) and what should go in profilename_profile_final.