You are here

function hostmaster_task_finalize in Hostmaster (Aegir) 6

Same name and namespace in other branches
  1. 6.2 hostmaster.profile \hostmaster_task_finalize()
  2. 7.4 hostmaster.install \hostmaster_task_finalize()
  3. 7.3 hostmaster.install \hostmaster_task_finalize()
1 call to hostmaster_task_finalize()
hostmaster_profile_tasks in ./hostmaster.profile

File

./hostmaster.profile, line 185

Code

function hostmaster_task_finalize() {
  variable_set('install_profile', 'hostmaster');
  drupal_set_message(st('Configuring menu items'));
  install_include(array(
    'menu',
  ));
  $menu_name = variable_get('menu_primary_links_source', 'primary-links');

  // @TODO - seriously need to simplify this, but in our own code i think, not install profile api
  $items = install_menu_get_items('hosting/servers');
  $item = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE mlid = %d", $items[0]['mlid']));
  $item['menu_name'] = $menu_name;
  $item['customized'] = 1;
  $item['options'] = unserialize($item['options']);
  install_menu_update_menu_item($item);
  $items = install_menu_get_items('hosting/sites');
  $item = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE mlid = %d", $items[0]['mlid']));
  $item['menu_name'] = $menu_name;
  $item['customized'] = 1;
  $item['options'] = unserialize($item['options']);
  install_menu_update_menu_item($item);
  $items = install_menu_get_items('hosting/platforms');
  $item = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE mlid = %d", $items[0]['mlid']));
  $item['menu_name'] = $menu_name;
  $item['customized'] = 1;
  $item['options'] = unserialize($item['options']);
  install_menu_update_menu_item($item);
  menu_rebuild();
  $theme = 'eldir';
  drupal_set_message(st('Configuring Eldir theme'));
  install_disable_theme('garland');
  install_default_theme('eldir');
  system_theme_data();
  db_query("DELETE FROM {cache}");
  drupal_set_message(st('Configuring default blocks'));
  install_add_block('hosting', 'hosting_queues', $theme, 1, 5, 'right', 1);
  drupal_set_message(st('Configuring roles'));
  install_remove_permissions(install_get_rid('anonymous user'), array(
    'access content',
    'access all views',
  ));
  install_remove_permissions(install_get_rid('authenticated user'), array(
    'access content',
    'access all views',
  ));
  install_add_permissions(install_get_rid('anonymous user'), array(
    'access disabled sites',
  ));
  install_add_permissions(install_get_rid('authenticated user'), array(
    'access disabled sites',
  ));
  install_add_role('aegir client');

  // @todo we may need to have a hook here to consider plugins
  install_add_permissions(install_get_rid('aegir client'), array(
    'access content',
    'access all views',
    'edit own client',
    'view client',
    'create site',
    'delete site',
    'view site',
    'create backup task',
    'create delete task',
    'create disable task',
    'create enable task',
    'create restore task',
    'view own tasks',
    'view task',
    'cancel own tasks',
  ));
  install_add_role('aegir account manager');
  install_add_permissions(install_get_rid('aegir account manager'), array(
    'create client',
    'edit client users',
    'view client',
  ));
  node_access_rebuild();
}