You are here

function commons_install_finished in Drupal Commons 7.3

Override of install_finished() without the useless text.

1 string reference to 'commons_install_finished'
commons_install_tasks_alter in ./commons.install
Implements hook_install_tasks_alter().

File

./commons.install, line 73
Install, update and uninstall functions for the Commons install profile.

Code

function commons_install_finished(&$install_state) {
  drupal_set_title(st('@drupal installation complete', array(
    '@drupal' => drupal_install_profile_distribution_name(),
  )), PASS_THROUGH);
  $messages = drupal_set_message();

  // Remember the profile which was used.
  variable_set('install_profile', drupal_get_profile());
  variable_set('install_task', 'done');

  // BEGIN copy/paste from install_finished().
  // Remove the bookmarks flag
  $flag = flag_get_flag('bookmarks');
  if ($flag) {
    $flag
      ->delete();
    $flag
      ->disable();
    _flag_clear_cache();
  }

  // Flush all caches to ensure that any full bootstraps during the installer
  // do not leave stale cached data, and that any content types or other items
  // registered by the installation profile are registered correctly.
  drupal_flush_all_caches();

  // We make custom code for the footer here because we want people to be able to freely edit it if they wish.
  $footer_body = '<p>' . st('A Commons Community, powered by <a href="@acquia">Acquia</a>', array(
    '@acquia' => url('https://www.acquia.com/products-services/drupal-commons-social-business-software'),
  )) . '</p>';
  $footer_block_text = array(
    'body' => st($footer_body),
    'info' => st('Default Footer'),
    'format' => 'full_html',
  );
  if (drupal_write_record('block_custom', $footer_block_text)) {
    $footer_block = array(
      'module' => 'block',
      'delta' => $footer_block_text['bid'],
      'theme' => 'commons_origins',
      'visibility' => 0,
      'region' => 'footer',
      'status' => 1,
      'pages' => 0,
      'weight' => 1,
      'title' => variable_get('site_name', 'Drupal Commons'),
    );
    drupal_write_record('block', $footer_block);
  }

  // Installation profiles are always loaded last
  db_update('system')
    ->fields(array(
    'weight' => 1000,
  ))
    ->condition('type', 'module')
    ->condition('name', drupal_get_profile())
    ->execute();

  // Cache a fully-built schema.
  drupal_get_schema(NULL, TRUE);

  // Run cron to populate update status tables (if available) so that users
  // will be warned if they've installed an out of date Drupal version.
  // Will also trigger indexing of profile-supplied content or feeds.
  drupal_cron_run();
  variable_set('title_node', array(
    'auto_attach' => array(
      'title' => 'title',
    ),
    'hide_label' => array(
      'page' => 0,
      'entity' => 0,
    ),
  ));
  if (isset($messages['error'])) {
    $output = '<p>' . (isset($messages['error']) ? st('Review the messages above before visiting <a href="@url">your new site</a>.', array(
      '@url' => url(''),
    )) : st('<a href="@url">Visit your new site</a>.', array(
      '@url' => url(''),
    ))) . '</p>';
    return $output;
  }
  else {

    // Since any module can add a drupal_set_message, this can bug the user
    // when we redirect him to the front page. For a better user experience,
    // remove all the message that are only "notifications" message.
    drupal_get_messages('status', TRUE);
    drupal_get_messages('completed', TRUE);

    // Migrate adds its messages under the wrong type, see #1659150.
    drupal_get_messages('ok', TRUE);

    // If we don't install drupal using Drush, redirect the user to the front
    // page.
    if (!drupal_is_cli()) {
      drupal_goto('');
    }
  }
}