Add more info at status page

This commit is contained in:
Pig Fang 2019-08-28 14:52:51 +08:00
parent 8bb617623e
commit 49bf12675d
6 changed files with 83 additions and 6 deletions

View File

@ -10,6 +10,7 @@ use App\Models\User;
use App\Models\Player;
use App\Notifications;
use App\Models\Texture;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use App\Services\OptionForm;
use Illuminate\Http\Request;
@ -363,11 +364,24 @@ class AdminController extends Controller
public function status(Request $request)
{
return view('admin.status', [
'phpVersion' => PHP_VERSION,
'webSoftware' => $request->server('SERVER_SOFTWARE', trans('general.unknown')),
'os' => sprintf('%s %s %s', php_uname('s'), php_uname('r'), php_uname('m')),
]);
$db = get_db_config();
return view('admin.status')
->with('detail', [
'server' => [
'php' => PHP_VERSION,
'web' => $request->server('SERVER_SOFTWARE', trans('general.unknown')),
'os' => sprintf('%s %s %s', php_uname('s'), php_uname('r'), php_uname('m')),
],
'db' => [
'type' => humanize_db_type(),
'host' => Arr::get($db, 'host', ''),
'port' => Arr::get($db, 'port', ''),
'username' => Arr::get($db, 'username'),
'database' => Arr::get($db, 'database'),
'prefix' => Arr::get($db, 'prefix'),
],
]);
}
public function getUserData(Request $request, User $users)

View File

@ -254,7 +254,7 @@ if (! function_exists('humanize_db_type')) {
function humanize_db_type($type = null): string
{
$map = [
'mysql' => 'MySQL',
'mysql' => 'MySQL/MariaDB',
'sqlite' => 'SQLite',
'pgsql' => 'PostgreSQL',
];

View File

@ -84,6 +84,21 @@ customize:
black: Black
black-light: Black Light
status:
server:
name: Server
php: PHP Version
web: Web Server Software
os: OS
db:
name: Database
type: Server
host: Host
port: Port
username: Username
database: Database
prefix: Table Prefix
plugins:
name: Name
description: Description

View File

@ -84,6 +84,21 @@ customize:
black: 黑色主题
black-light: 黑色主题 - 白色侧边栏
status:
server:
name: 服务器
php: PHP 版本
web: Web 服务软件
os: 操作系统
db:
name: 数据库
type: 服务器类型
host: 主机
port: 端口
username: 用户名
database: 数据库
prefix: 数据表前缀
plugins:
name: 名称
description: 描述

View File

@ -9,6 +9,32 @@
</section>
<section class="content">
<div class="row">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="box">
<div class="box-header"></div>
<div class="box-body">
<table class="table table-bordered table-striped">
<tbody>
@foreach ($detail as $category => $info)
<tr>
<th colspan="2">@lang("admin.status.$category.name")</th>
</tr>
@foreach ($info as $key => $value)
<tr>
<td>@lang("admin.status.$category.$key")</td>
<td>{{ $value }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
</section>
</div>
@endsection

View File

@ -116,6 +116,13 @@ class AdminControllerTest extends TestCase
Notification::assertNotSentTo($admin, Notifications\SiteMessage::class);
}
public function testStatus()
{
$this->get('/admin/status')
->assertSee(PHP_VERSION)
->assertSee(humanize_db_type());
}
public function testUsers()
{
$this->get('/admin/users')->assertSee(trans('general.user-manage'));