From f8936cd49b29cc11efc60ef8557465b861843c0e Mon Sep 17 00:00:00 2001 From: Chenx221 Date: Fri, 12 Apr 2024 16:15:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E4=BF=A1=E6=81=AF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA(2/3)=20*=E8=BF=98=E6=9C=89=E5=BE=88=E5=A4=9A=E6=94=B9?= =?UTF-8?q?=E8=BF=9B=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/AdminController.php | 34 +++--------- views/admin/sysinfo.php | 96 +++++++++++++++++---------------- 2 files changed, 56 insertions(+), 74 deletions(-) diff --git a/controllers/AdminController.php b/controllers/AdminController.php index 80e5682..b56b7fc 100644 --- a/controllers/AdminController.php +++ b/controllers/AdminController.php @@ -14,7 +14,7 @@ use app\models\User; use app\models\UserSearch; use app\utils\AdminSword; use app\utils\FileSizeHelper; -use DateTime; +use app\utils\SystemInfoHelper; use OTPHP\TOTP; use RuntimeException; use Throwable; @@ -586,40 +586,18 @@ class AdminController extends Controller */ public function actionSysinfo(): string { - return $this->render('sysinfo'); + $fullInfo = SystemInfoHelper::getSysInfoInit(); + return $this->render('sysinfo', [ + 'systemInfo' => $fullInfo, + ]); } /** * Get server status - * 只兼容Windows和Linux - * other不考虑 * @return void */ public function actionGetServerStatus(): void { - //需要收集的信息 - //hostname - //os - //cpu - //memory - //server time - //server uptime - //is windows? - //server load - //server cpu usage - //server memory usage - //storage data drive - //file system - //drive size - //drive used & free - //dns server - //gateway - //network interface(status,speed,ipv4v6 address) - //All users number - //active users number(24h) - //share number,collection number - //php version,memory limit,max execution time,max upload size,max post size,extension - //database type,version,size - //迁移到SystemInfoHelper Util + } } diff --git a/views/admin/sysinfo.php b/views/admin/sysinfo.php index f98bd01..3709a2c 100644 --- a/views/admin/sysinfo.php +++ b/views/admin/sysinfo.php @@ -1,7 +1,10 @@ title = '系统信息';

- + hostname ?>

OS: - + os ?>

CPU: - + cpu ?>

RAM: - + ram ?>

Server Time: - + serverTime ?>

Server Up Time: - + serverUpTime ?>


-
-

- - Load -

- -

- -

-
+ osType === 2): ?> +
+

+ + Load +

+ +

+ Load Average: load ?> (Last 1 min) +

+
+

@@ -58,15 +63,15 @@ $this->title = '系统信息';

- + CPU Usage: cpuUsage ?>%

- RAM + Memory

- +

@@ -90,19 +95,19 @@ $this->title = '系统信息';

Data

Mount: - + dataMountPoint ?>
File System: - + mp_fs ?>
Size: - + mp_size ?>
Free: - + mp_avail ?>
Used: - + mp_used ?>
@@ -114,32 +119,31 @@ $this->title = '系统信息';

Hostname: - + hostname ?>

DNS: - + dns ?>

Gateway: - + gateway ?>

-
-

+

nic['interfaceName'] ?>

Status: - + nic['mac'] ?>
Speed: - + nic['speed'] ?>
IPv4: - + nic['ipv4'] ?>
IPv6: - + nic['ipv6'] ?>
@@ -152,10 +156,10 @@ $this->title = '系统信息';
All: - + users ?>
Active (within 24h): - + activeUsers ?>

@@ -167,7 +171,7 @@ $this->title = '系统信息';
Link: - + shares ?>
@@ -177,7 +181,7 @@ $this->title = '系统信息';
Collection: - + collections ?>
@@ -190,22 +194,22 @@ $this->title = '系统信息';
Version: - + phpVersion ?>
Memory Limit: - + memoryLimit ?>
Max Execution Time: - + maxExecutionTime ?>
Upload Max Filesize: - + uploadMaxFilesize ?>
Post Max Size: - + postMaxSize ?>
Extension: - + extensions ?>
@@ -215,13 +219,13 @@ $this->title = '系统信息';
Type: - + dbType ?>
Version: - + dbVersion ?>
Size: - + dbSize ?>