1
0
mirror of https://github.com/flarum/core.git synced 2025-08-06 08:27:42 +02:00

additions

This commit is contained in:
Daniël Klabbers
2024-12-31 17:57:29 +01:00
parent 55979706f1
commit a1e1f6ad33
6 changed files with 69 additions and 7 deletions

View File

@@ -29,18 +29,19 @@ class GatherDebugInformation implements Middleware
$currentUser = get_current_user();
if ($user !== $currentUser) {
$this->settings->set(
'core.web_user',
"core.debug.web_user",
$currentUser
);
}
// Read the opcache situation, this is only visible in web.
$opcache = $this->settings->get('core.debug.opcache_enabled');
// Cli has opcache disabled by default.
$opcache = $this->settings->get('core.debug.opcache');
$opcacheStatus = function_exists('opcache_get_configuration')
&& opcache_get_configuration() !== false;
&& opcache_get_configuration() !== false ? 'on' : 'off';
if ($opcache !== $opcacheStatus) {
$this->settings->set(
'core.debug.opcache_enabled',
'core.debug.opcache',
$opcacheStatus
);
}

View File

@@ -16,8 +16,10 @@ class Report
protected array $sections = [
Section\CoreVersion::class,
Section\PHP::class,
Section\Database::class,
Section\EnabledExtensions::class,
Section\Features::class,
Section\Webserver::class,
Section\Debug::class,
];

View File

@@ -0,0 +1,27 @@
<?php
namespace Flarum\Foundation\Info\Section;
use Flarum\Foundation\ApplicationInfoProvider;
use Flarum\Foundation\Info\RendererInterface;
use Flarum\Foundation\Info\SectionInterface;
class Database implements SectionInterface
{
public function __construct(protected ApplicationInfoProvider $appInfo)
{
}
public function __invoke(RendererInterface $renderer): void
{
$renderer->keyValue(
'Database driver',
$this->appInfo->identifyDatabaseDriver()
);
$renderer->keyValue(
'Database version',
$this->appInfo->identifyDatabaseVersion()
);
}
}

View File

@@ -13,12 +13,14 @@ use Flarum\Foundation\ApplicationInfoProvider;
use Flarum\Foundation\Info\RendererInterface;
use Flarum\Foundation\Info\SectionInterface;
use Flarum\Mail\NullDriver;
use Flarum\Settings\SettingsRepositoryInterface;
use Illuminate\Contracts\Container\Container;
class Features implements SectionInterface
{
public function __construct(
protected ApplicationInfoProvider $appInfo,
protected SettingsRepositoryInterface $settings,
protected Container $container
) {
}
@@ -54,7 +56,7 @@ class Features implements SectionInterface
protected function mail()
{
$driver = $this->container->make('mail.driver');
$configured = $this->container->make('flarum.mail.configured_driver');
$configured = $this->settings->get('mail_driver');
if ($driver instanceof NullDriver) {
$configured .= ' (not active)';

View File

@@ -12,11 +12,14 @@ namespace Flarum\Foundation\Info\Section;
use Flarum\Foundation\ApplicationInfoProvider;
use Flarum\Foundation\Info\RendererInterface;
use Flarum\Foundation\Info\SectionInterface;
use Flarum\Settings\SettingsRepositoryInterface;
class PHP implements SectionInterface
{
public function __construct(protected ApplicationInfoProvider $appInfo)
{
public function __construct(
protected ApplicationInfoProvider $appInfo,
protected SettingsRepositoryInterface $settings
) {
}
public function __invoke(RendererInterface $renderer): void
@@ -30,5 +33,10 @@ class PHP implements SectionInterface
'PHP extensions',
implode(', ', get_loaded_extensions())
);
$renderer->keyValue(
'PHP OpCache',
$this->settings->get('core.debug.opcache') ?? 'visit admin to identify'
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace Flarum\Foundation\Info\Section;
use Flarum\Foundation\Info\RendererInterface;
use Flarum\Foundation\Info\SectionInterface;
use Flarum\Settings\SettingsRepositoryInterface;
class Webserver implements SectionInterface
{
public function __construct(protected SettingsRepositoryInterface $settings)
{
}
public function __invoke(RendererInterface $renderer): void
{
$renderer->keyValue(
'Web user',
$this->settings->get('core.debug.web_user') ?? 'visit admin to identify'
);
}
}