You are here

function hostmaster_task_finalize in Hostmaster (Aegir) 6.2

Same name and namespace in other branches
  1. 6 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 187

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);
  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('user', 0, $theme, 1, -1, 'right', 1);
  install_add_block('user', 1, $theme, 1, 1, 'right', 1);
  install_add_block('hosting', 'hosting_queues', $theme, 1, 5, 'right', 1);
  install_add_block('views', 'hosting_task_list-block', $theme, 1, 0, 'right', 0);

  // TODO: Set visibility in Views on Drupal 7
  install_add_block('views', 'hosting_site_list-block_1', $theme, 1, 0, 'content_bottom', 1, 'hosting/c/platform_*');
  install_add_block('views', 'hosting_site_list-block_profile', $theme, 1, 0, 'content_bottom', 2, "<?php\n\nreturn hosting_site_profile_block_visibility();\n\n?>");
  install_add_block('views', 'hosting_site_list-block_client', $theme, 1, 0, 'content_bottom', 2, "<?php\n\nreturn hosting_site_client_admin_block_visibility();\n\n?>");
  install_add_block('views', 'hosting_site_list-block_client2', $theme, 1, 0, 'content_bottom', 2, "<?php\n\nreturn hosting_site_client_list_block_visibility();\n\n?>");
  install_add_block('views', 'hosting_package_list-block_1', $theme, 1, 0, 'content_bottom', 2, "<?php\n\nreturn hosting_site_profile_block_visibility();\n\n?>");
  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',
    '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',
    'view own quota',
    'create site aliases',
    'create verify task',
    'create clone task',
    'create migrate task',
    'create ssl certificate',
    'access task logs',
    'view package',
    'execute Site: Backup (hosting_site_op_backup)',
    'execute Site: Delete (hosting_site_op_delete)',
    'execute Site: Disable (hosting_site_op_disable)',
    'execute Site: Enable (hosting_site_op_enable)',
    'execute Site: Reset password (hosting_site_op_login_reset)',
    'execute Site: Verify (hosting_site_op_verify)',
  ), 'view platform', 'view revisions', 'edit site');
  install_add_role('aegir account manager');
  install_add_permissions(install_get_rid('aegir account manager'), array(
    'create client',
    'edit client users',
    'view client',
    'administer clients',
    'access content',
    'access user profiles',
    'edit all quotas',
    'view all quotas',
    'view own quota',
    'edit client uname',
  ), 'view_site');
  install_add_role('aegir platform manager');
  install_add_permissions(install_get_rid('aegir platform manager'), array(
    'create clone task',
    'create migrate task',
    'create platform',
    'delete platform',
    'edit platform',
    'view locked platforms',
    'view platform',
    'create sites on locked platforms',
    'create site',
    'delete site',
    'edit site',
    'view site',
    'access task logs',
    'create lock task',
    'create unlock task',
    'view revisions',
    'search content',
    'use advanced search',
    'view package',
    'administer platforms',
    'cancel own tasks',
    'view own tasks',
    'access content',
    'view own tasks',
    'view task',
    'administer sites',
    'create verify task',
    'retry failed tasks',
    'administer clients',
    'execute Site: Delete (hosting_site_op_delete)',
    'execute Site: Disable (hosting_site_op_disable)',
    'execute Site: Enable (hosting_site_op_enable)',
    'execute Site: Verify (hosting_site_op_verify)',
    'execute Platform: Delete (hosting_platform_op_delete)',
    'execute Platform: Lock (hosting_platform_op_lock)',
    'execute Platform: Unlock (hosting_platform_op_unlock)',
    'execute Platform: Verify (hosting_platform_op_verify)',
    'administer tasks',
  ));
  install_add_role('aegir administrator');
  install_add_permissions(install_get_rid('aegir administrator'), array(
    'access disabled sites',
    'access hosting wizard',
    'administer hosting',
    'administer hosting features',
    'administer hosting queues',
    'administer hosting settings',
    'administer hosting aliases',
    'create site aliases',
    'administer clients',
    'create client',
    'delete own client',
    'edit client uname',
    'edit client users',
    'edit own client',
    'view client',
    'create clone task',
    'create migrate task',
    'create package',
    'delete package',
    'edit package',
    'view package',
    'create platform',
    'delete platform',
    'edit platform',
    'view locked platforms',
    'view platform',
    'create sites on locked platforms',
    'edit all quotas',
    'view all quotas',
    'view own quota',
    'create server',
    'delete server',
    'edit server',
    'view server',
    'access hosting signup form',
    'administer sites',
    'create site',
    'delete site',
    'edit site',
    'view site',
    'access task logs',
    'administer tasks',
    'cancel own tasks',
    'create backup task',
    'create backup-delete task',
    'create delete task',
    'create disable task',
    'create enable task',
    'create lock task',
    'create login-reset task',
    'create restore task',
    'create unlock task',
    'create verify task',
    'retry failed tasks',
    'view own tasks',
    'view task',
    'access administration menu',
    'administer platforms',
    'administer servers',
    'access content',
    'view revisions',
    'administer hosting aliases',
    'create site aliases',
    'edit all quotas',
    'view all quotas',
    'view own quota',
    'access hosting signup form',
    'create ssl certificate',
    'access user profiles',
    'execute Site: Backup (hosting_site_op_backup)',
    'execute Site: Delete (hosting_site_op_delete)',
    'execute Site: Disable (hosting_site_op_disable)',
    'execute Site: Enable (hosting_site_op_enable)',
    'execute Site: Reset password (hosting_site_op_login_reset)',
    'execute Site: Verify (hosting_site_op_verify)',
    'execute Platform: Delete (hosting_platform_op_delete)',
    'execute Platform: Lock (hosting_platform_op_lock)',
    'execute Platform: Unlock (hosting_platform_op_unlock)',
    'execute Platform: Verify (hosting_platform_op_verify)',
  ), 'update status of tasks');
  node_access_rebuild();
}