You are here

public function SecurityReview::setServerData in Security Review 8

Stores information about the server into the State system.

File

src/SecurityReview.php, line 286

Class

SecurityReview
A class containing static methods regarding the module's configuration.

Namespace

Drupal\security_review

Code

public function setServerData() {
  if (!static::isServerPosix() || PHP_SAPI === 'cli') {
    return;
  }

  // Determine web server's uid and groups.
  $uid = posix_getuid();
  $groups = posix_getgroups();

  // Store the data in the State system.
  $this->state
    ->set('security_review.server.uid', $uid);
  $this->state
    ->set('security_review.server.groups', $groups);
}