You are here

function drupal_commons_cleanup in Drupal Commons 6.2

Same name and namespace in other branches
  1. 6 drupal_commons.profile \drupal_commons_cleanup()

Various actions needed to clean up after the installation

1 string reference to 'drupal_commons_cleanup'
drupal_commons_profile_tasks in ./drupal_commons.profile
Perform any final installation tasks for this profile.

File

./drupal_commons.profile, line 499

Code

function drupal_commons_cleanup() {

  // Rebuild node access database - required after OG installation
  node_access_rebuild();

  // Rebuild node types
  node_types_rebuild();

  // Clear drupal message queue for non-warning/errors
  drupal_get_messages('status', TRUE);

  // Clear out caches
  $core = array(
    'cache',
    'cache_block',
    'cache_filter',
    'cache_page',
  );
  $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
  foreach ($cache_tables as $table) {
    cache_clear_all('*', $table, TRUE);
  }

  // Clear out JS and CSS caches
  drupal_clear_css_cache();
  drupal_clear_js_cache();

  // Some features will need reverting
  $revert = array(
    'commons_core' => array(
      'menu_links',
    ),
    'commons_notifications' => array(
      'variable',
    ),
    'commons_seo' => array(
      'variable',
    ),
    'commons_blog' => array(
      'menu_links',
      'user_permission',
    ),
    'commons_event' => array(
      'menu_links',
    ),
    'commons_poll' => array(
      'menu_links',
    ),
    'commons_document' => array(
      'menu_links',
    ),
    'commons_discussion' => array(
      'menu_links',
    ),
    'commons_wiki' => array(
      'menu_links',
      'variable',
    ),
    'commons_home' => array(
      'page_manager_pages',
    ),
    'commons_reputation' => array(
      'menu_links',
    ),
    'commons_admin' => array(
      'user_permission',
    ),
    'commons_answers' => array(
      'user_permission',
    ),
  );

  // Make sure we only try to revert features we've enabled
  $enabled = variable_get('commons_selected_features', array(
    'commons_core',
  ));
  foreach ($revert as $feature => $value) {
    if (!in_array($feature, $enabled)) {
      unset($revert[$feature]);
    }
  }
  features_revert($revert);

  // Say hello to the dog!
  watchdog('commons', st('Welcome to Commons from Acquia!'));

  // Create a test group which contains a node
  drupal_commons_create_group();

  // Rebuild Activity Log templates.
  activity_log_rebuild_everything();

  // Remove the feature choices
  variable_del('commons_selected_features');

  // Finish the installation
  variable_set('install_task', 'profile-finished');
}