You are here

function _nagios_update_os_user in Nagios Monitoring 7

Same name and namespace in other branches
  1. 8 nagios.module \_nagios_update_os_user()

Update the information under which operating system user PHP is currently running. This helps to detect permission problems when CLI and web users differ.

3 calls to _nagios_update_os_user()
nagios_check in ./nagios.drush.inc
Helper function for drush_nagios_check().
nagios_settings in ./nagios.module
Callback for the settings page
nagios_status_page in ./nagios.module
Callback for the nagios status page

File

./nagios.module, line 99

Code

function _nagios_update_os_user() {
  $os_user = variable_get('nagios_os_user', []);
  $current_user = posix_getpwuid(posix_geteuid())['name'];
  if (isset($os_user[PHP_SAPI]) && $os_user[PHP_SAPI] == $current_user) {

    // Already up-to-date
    return $os_user;
  }
  $os_user[PHP_SAPI] = $current_user;
  variable_set('nagios_os_user', $os_user);
  return $os_user;
}