function _provision_drush_check_user

7.x-3.x provision.drush.inc _provision_drush_check_user()

This will abort any process running drush provision commands if the user running the command is root.

Related topics

1 call to _provision_drush_check_user()
provision_drush_init in ./provision.drush.inc
Implements hook_drush_init().

File

./provision.drush.inc, line 67
Provision Drush commands.

Code

function _provision_drush_check_user() {
  $command = drush_get_command();
  $name = posix_getpwuid(posix_geteuid());
  if (preg_match("/^provision-\b/", $command['command']) && $name['name'] == 'root') {
    return drush_set_error('PROVISION_IS_ROOT', dt('You are running the provision script as the root user. Exiting'));
  }
}