'provision-status-none', PROVISION_STATUS_SUCCESS => 'provision-status-success', PROVISION_STATUS_WARNING => 'provision-status-warning', PROVISION_STATUS_ERROR => 'provision-status-error', ); } return $map[$status]; } /** * Constants used to configure contextual hosting help */ /** Display component of help **/ define('PROVISION_HELP_ENABLED', 1); /** Don't show help component **/ define('PROVISION_HELP_DISABLED', ~PROVISION_HELP_ENABLED); /** These are internally used to test against. Use the COLLAPSIBLE AND COLLAPSED instead **/ define('_PROVISION_HELP_CAN_COLLAPSE', 2); define('_PROVISION_HELP_HAS_COLLAPSED', 4); /** * Show help with the ability to collapse to save space. * This automatically enables the help component **/ define('PROVISION_HELP_COLLAPSIBLE', PROVISION_HELP_ENABLED | _PROVISION_HELP_CAN_COLLAPSE); /** * Display help component with an initial collapsed state. * This automatically enables and sets the help component to be collapsible */ define('PROVISION_HELP_COLLAPSED', PROVISION_HELP_COLLAPSIBLE | _PROVISION_HELP_HAS_COLLAPSED); /** * Returns a class name for the output of the form elementG */ function _provision_help_class($state) { static $map; if (!sizeof($map)) { $map = array( PROVISION_HELP_ENABLED => 'provision-help', PROVISION_HELP_COLLAPSIBLE => 'provision-help-collapsible', PROVISION_HELP_COLLAPSED => 'provision-help-collapsed' ); } return $map[$state]; } /** * Implementation of hook_help() */ function provision_help($section) { switch ($section) { case 'admin/help#provision': $output .= t('
The Provision framework is a powerful set of modules that lets you to accomplish a lot of maintenance tasks through the unix command line such as installing new sites, backing them up, rolling back to previous backups and facilitating upgrades.
'); $output .= t('Additionally, the Provision framework is one component of the distributed hosting infrastructure provided by the hostmaster
install profile.
The Hostmaster profile is capable of driving several provision backends, in a distributed manner, and provides an interface for the functionality of provision.
It is not required to run the hosting front end to use the Provision framework, but the system does not provide much in the way of a web accessible front end, by design.
'); $output .= 'For a more detailed breakdown of steps that need to be taken to configure Provisioning to run with your system, please read the in depth requirement documentation
', array('@url' => url('admin/help/provision/requirements'))); $output .= 'drush.php $command
" . '--$option
" . '@backup_path
,
but you can change this in the provisioning section.', $mkdir_cmd);
$help['configuration'] = t('Please enter the following commands : @mkdir_cmd', $mkdir_cmd); return $help; } function _provision_group_requirements() { $username = PROVISION_SCRIPT_USER; $group = PROVISION_WEB_GROUP; $vigr_cmd = <<
@group
",
but you can change these in the provisioning section.',
array("@username" => $username, "@group" => $group, "@provision_link" => url('admin/settings/provision')));
$help['configuration'] =t('If your user is not a member of the web group, you can add them by using the
adduser
command:
@vigr_cmdIf that command is not available, you will need to edit the /etc/group file directly with your vigr or your favorite editor. Find the line that says :
@vigr1Then add the username to the end of the line, so that it looks like :
@vigr2If there were already users in the group, add your user to the group using a comma as separator :
@vigr3', array('@vigr_cmd' => $vigr_cmd, '@vigr1' => $vigr1, '@vigr2' => $vigr2, '@vigr3' => $vigr3)); return $help; } /** * Implementation of hook_elements. * * Defines a number of form elements that are used for formatting the contextual help * in forms. */ function provision_elements() { $type['requirement_help'] = array( '#requirement' => null, '#status' => PROVISION_STATUS_NONE, '#heading' => PROVISION_HELP_ENABLED, '#summary' => PROVISION_HELP_ENABLED, '#summary_prefix' => t("What is this?"), '#configuration' => PROVISION_HELP_COLLAPSED, '#configuration_prefix' => t("How do I configure this?"), '#default_messages' => array( PROVISION_STATUS_SUCCESS => t("You have met this requirement."), PROVISION_STATUS_WARNING => t("This requirement has a non critical error."), PROVISION_STATUS_ERROR => t("This requirement has a critical error. This system will not operate until it has been fixed")), '#process' => array('provision_requirement_process' => array()), ); return $type; } /** * Places the various help components info the $element array */ function provision_requirement_process(&$element) { if (!$element['#requirement']) { return element; } $element['#help'] = provision_get_requirement($element['#requirement']); return $element; } /** * Theme function for displaying contextual help. * * Can control individual components of the help, for display in various places. */ function theme_requirement_help(&$element) { drupal_add_js(drupal_get_path('module', 'provision') . '/provision.js'); drupal_add_css(drupal_get_path('module', 'provision') . '/provision.css'); $req = $element['#requirement']; $help = $element['#help']; // this is just to make it easier to work with. //place anchor so user can be directed to right page. $output .= ""; $output .= '
" . implode("
", $help[$key]) . "