mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
additions
This commit is contained in:
@@ -29,18 +29,19 @@ class GatherDebugInformation implements Middleware
|
|||||||
$currentUser = get_current_user();
|
$currentUser = get_current_user();
|
||||||
if ($user !== $currentUser) {
|
if ($user !== $currentUser) {
|
||||||
$this->settings->set(
|
$this->settings->set(
|
||||||
'core.web_user',
|
"core.debug.web_user",
|
||||||
$currentUser
|
$currentUser
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the opcache situation, this is only visible in web.
|
// 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')
|
$opcacheStatus = function_exists('opcache_get_configuration')
|
||||||
&& opcache_get_configuration() !== false;
|
&& opcache_get_configuration() !== false ? 'on' : 'off';
|
||||||
if ($opcache !== $opcacheStatus) {
|
if ($opcache !== $opcacheStatus) {
|
||||||
$this->settings->set(
|
$this->settings->set(
|
||||||
'core.debug.opcache_enabled',
|
'core.debug.opcache',
|
||||||
$opcacheStatus
|
$opcacheStatus
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,10 @@ class Report
|
|||||||
protected array $sections = [
|
protected array $sections = [
|
||||||
Section\CoreVersion::class,
|
Section\CoreVersion::class,
|
||||||
Section\PHP::class,
|
Section\PHP::class,
|
||||||
|
Section\Database::class,
|
||||||
Section\EnabledExtensions::class,
|
Section\EnabledExtensions::class,
|
||||||
Section\Features::class,
|
Section\Features::class,
|
||||||
|
Section\Webserver::class,
|
||||||
Section\Debug::class,
|
Section\Debug::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
27
framework/core/src/Foundation/Info/Section/Database.php
Normal file
27
framework/core/src/Foundation/Info/Section/Database.php
Normal 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()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -13,12 +13,14 @@ use Flarum\Foundation\ApplicationInfoProvider;
|
|||||||
use Flarum\Foundation\Info\RendererInterface;
|
use Flarum\Foundation\Info\RendererInterface;
|
||||||
use Flarum\Foundation\Info\SectionInterface;
|
use Flarum\Foundation\Info\SectionInterface;
|
||||||
use Flarum\Mail\NullDriver;
|
use Flarum\Mail\NullDriver;
|
||||||
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
use Illuminate\Contracts\Container\Container;
|
use Illuminate\Contracts\Container\Container;
|
||||||
|
|
||||||
class Features implements SectionInterface
|
class Features implements SectionInterface
|
||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected ApplicationInfoProvider $appInfo,
|
protected ApplicationInfoProvider $appInfo,
|
||||||
|
protected SettingsRepositoryInterface $settings,
|
||||||
protected Container $container
|
protected Container $container
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
@@ -54,7 +56,7 @@ class Features implements SectionInterface
|
|||||||
protected function mail()
|
protected function mail()
|
||||||
{
|
{
|
||||||
$driver = $this->container->make('mail.driver');
|
$driver = $this->container->make('mail.driver');
|
||||||
$configured = $this->container->make('flarum.mail.configured_driver');
|
$configured = $this->settings->get('mail_driver');
|
||||||
|
|
||||||
if ($driver instanceof NullDriver) {
|
if ($driver instanceof NullDriver) {
|
||||||
$configured .= ' (not active)';
|
$configured .= ' (not active)';
|
||||||
|
@@ -12,11 +12,14 @@ namespace Flarum\Foundation\Info\Section;
|
|||||||
use Flarum\Foundation\ApplicationInfoProvider;
|
use Flarum\Foundation\ApplicationInfoProvider;
|
||||||
use Flarum\Foundation\Info\RendererInterface;
|
use Flarum\Foundation\Info\RendererInterface;
|
||||||
use Flarum\Foundation\Info\SectionInterface;
|
use Flarum\Foundation\Info\SectionInterface;
|
||||||
|
use Flarum\Settings\SettingsRepositoryInterface;
|
||||||
|
|
||||||
class PHP implements SectionInterface
|
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
|
public function __invoke(RendererInterface $renderer): void
|
||||||
@@ -30,5 +33,10 @@ class PHP implements SectionInterface
|
|||||||
'PHP extensions',
|
'PHP extensions',
|
||||||
implode(', ', get_loaded_extensions())
|
implode(', ', get_loaded_extensions())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$renderer->keyValue(
|
||||||
|
'PHP OpCache',
|
||||||
|
$this->settings->get('core.debug.opcache') ?? 'visit admin to identify'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
22
framework/core/src/Foundation/Info/Section/Webserver.php
Normal file
22
framework/core/src/Foundation/Info/Section/Webserver.php
Normal 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'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user