public static function SpiController::getPlatform in Acquia Connector 8
Same name and namespace in other branches
- 8.2 src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::getPlatform()
- 3.x src/Controller/SpiController.php \Drupal\acquia_connector\Controller\SpiController::getPlatform()
Gather platform specific information.
Return value
array An associative array keyed by a platform information type.
1 call to SpiController::getPlatform()
- SpiController::get in src/
Controller/ SpiController.php - Gather site profile information about this site.
File
- src/
Controller/ SpiController.php, line 876
Class
- SpiController
- SPI Controller class.
Namespace
Drupal\acquia_connector\ControllerCode
public static function getPlatform() {
$server = \Drupal::request()->server;
// Database detection depends on the structure starting with the database.
$db_class = '\\Drupal\\Core\\Database\\Driver\\' . Database::getConnection()
->driver() . '\\Install\\Tasks';
$db_tasks = new $db_class();
// Webserver detection is based on name being before the slash, and
// version being after the slash.
preg_match('!^([^/]+)(/.+)?$!', $server
->get('SERVER_SOFTWARE'), $webserver);
if (isset($webserver[1]) && stristr($webserver[1], 'Apache') && function_exists('apache_get_version')) {
$webserver[2] = apache_get_version();
}
// Get some basic PHP vars.
$php_quantum = [
'memory_limit' => ini_get('memory_limit'),
'register_globals' => 'Off',
'post_max_size' => ini_get('post_max_size'),
'max_execution_time' => ini_get('max_execution_time'),
'upload_max_filesize' => ini_get('upload_max_filesize'),
'error_log' => ini_get('error_log'),
'error_reporting' => ini_get('error_reporting'),
'display_errors' => ini_get('display_errors'),
'log_errors' => ini_get('log_errors'),
'session.cookie_domain' => ini_get('session.cookie_domain'),
'session.cookie_lifetime' => ini_get('session.cookie_lifetime'),
'newrelic.appname' => ini_get('newrelic.appname'),
'sapi' => php_sapi_name(),
];
$platform = [
'php' => PHP_VERSION,
'webserver_type' => isset($webserver[1]) ? $webserver[1] : '',
'webserver_version' => isset($webserver[2]) ? $webserver[2] : '',
'php_extensions' => get_loaded_extensions(),
'php_quantum' => $php_quantum,
'database_type' => (string) $db_tasks
->name(),
'database_version' => Database::getConnection()
->version(),
'system_type' => php_uname('s'),
// php_uname() only accepts one character, so we need to concatenate
// ourselves.
'system_version' => php_uname('r') . ' ' . php_uname('v') . ' ' . php_uname('m') . ' ' . php_uname('n'),
];
return $platform;
}