SystemInfoController.php in Drupal 9
File
core/modules/system/src/Controller/SystemInfoController.php
View source
<?php
namespace Drupal\system\Controller;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Drupal\system\SystemManager;
class SystemInfoController implements ContainerInjectionInterface {
protected $systemManager;
public static function create(ContainerInterface $container) {
return new static($container
->get('system.manager'));
}
public function __construct(SystemManager $systemManager) {
$this->systemManager = $systemManager;
}
public function status() {
$requirements = $this->systemManager
->listRequirements();
return [
'#type' => 'status_report_page',
'#requirements' => $requirements,
];
}
public function php() {
if (function_exists('phpinfo')) {
ob_start();
phpinfo();
$output = ob_get_clean();
}
else {
$output = t('The phpinfo() function has been disabled for security reasons. For more information, visit <a href=":phpinfo">Enabling and disabling phpinfo()</a> handbook page.', [
':phpinfo' => 'https://www.drupal.org/node/243993',
]);
}
return new Response($output);
}
}