mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-15 13:32:41 +08:00
dashboard show redis version
This commit is contained in:
@@ -61,6 +61,7 @@ use NexusPlugin\Permission\Models\Role;
|
||||
use NexusPlugin\PostLike\PostLikeRepository;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotion;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator;
|
||||
use NexusPlugin\Tracker\TrackerRepository;
|
||||
use NexusPlugin\Work\Models\RoleWork;
|
||||
use NexusPlugin\Work\WorkRepository;
|
||||
use PhpIP\IP;
|
||||
@@ -100,10 +101,8 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$ip = "44,
|
||||
55,
|
||||
444,65 5 32";
|
||||
$result = preg_split("/[\r\n\s,,]+/", trim($ip));
|
||||
$tool = new TrackerRepository();
|
||||
$result = $tool->checkStatus();
|
||||
dd($result);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Models\User;
|
||||
use Carbon\Carbon;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class DashboardRepository extends BaseRepository
|
||||
{
|
||||
@@ -51,18 +52,26 @@ class DashboardRepository extends BaseRepository
|
||||
'text' => nexus_trans("dashboard.system_info.$name"),
|
||||
'value' => DB::select(DB::raw('select version() as info'))[0]->info,
|
||||
];
|
||||
$name = 'os';
|
||||
// $name = 'os';
|
||||
// $result[$name] = [
|
||||
// 'name' => $name,
|
||||
// 'text' => nexus_trans("dashboard.system_info.$name"),
|
||||
// 'value' => PHP_OS,
|
||||
// ];
|
||||
$name = 'redis_version';
|
||||
$result[$name] = [
|
||||
'name' => $name,
|
||||
'text' => nexus_trans("dashboard.system_info.$name"),
|
||||
'value' => PHP_OS,
|
||||
'value' => NexusDB::redis()->info()['redis_version'],
|
||||
];
|
||||
|
||||
$name = 'server_software';
|
||||
$result[$name] = [
|
||||
'name' => $name,
|
||||
'text' => nexus_trans("dashboard.system_info.$name"),
|
||||
'value' => $_SERVER['SERVER_SOFTWARE'] ?? '',
|
||||
];
|
||||
|
||||
$name = 'load_average';
|
||||
$result[$name] = [
|
||||
'name' => $name,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Http\Middleware\Locale;
|
||||
use App\Models\Invite;
|
||||
use App\Models\Message;
|
||||
use App\Models\News;
|
||||
@@ -503,4 +504,25 @@ class ToolRepository extends BaseRepository
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function sendAlarmEmail(string $subjectTransKey, array $subjectTransContext, string $msgTransKey, array $msgTransContext): void
|
||||
{
|
||||
$receiverUid = get_setting("system.alarm_email_receiver");
|
||||
if (empty($receiverUid)) {
|
||||
$locale = Locale::getDefault();
|
||||
$subject = nexus_trans($subjectTransKey, $subjectTransContext, $locale);
|
||||
$msg = nexus_trans($msgTransKey, $msgTransContext, $locale);
|
||||
do_log(sprintf("%s - %s", $subject, $msg), "error");
|
||||
} else {
|
||||
$receiverUidArr = preg_split("/[\r\n\s,,]+/", $receiverUid);
|
||||
$users = User::query()->whereIn("id", $receiverUidArr)->get(User::$commonFields);
|
||||
foreach ($users as $user) {
|
||||
$locale = $user->locale;
|
||||
$subject = nexus_trans($subjectTransKey, $subjectTransContext, $locale);
|
||||
$msg = nexus_trans($msgTransKey, $msgTransContext, $locale);
|
||||
$result = $this->sendMail($user->email, $subject, $msg);
|
||||
do_log(sprintf("send msg: %s result: %s", $msg, var_export($result, true)), $result ? "info" : "error");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5319,7 +5319,7 @@ function torrentTags($tags = 0, $type = 'checkbox')
|
||||
return $html;
|
||||
}
|
||||
|
||||
function saveSetting($prefix, $nameAndValue, $autoload = 'yes')
|
||||
function saveSetting(string $prefix, array $nameAndValue, string $autoload = 'yes'): void
|
||||
{
|
||||
$prefix = strtolower($prefix);
|
||||
$datetimeNow = date('Y-m-d H:i:s');
|
||||
|
||||
@@ -45,7 +45,12 @@ abstract class BasePlugin extends BaseRepository
|
||||
|
||||
public function trans($name): string
|
||||
{
|
||||
return nexus_trans(sprintf("%s::%s", static::ID, $name));
|
||||
return nexus_trans($this->getTransKey($name));
|
||||
}
|
||||
|
||||
public function getTransKey($name): string
|
||||
{
|
||||
return sprintf("%s::%s", static::ID, $name);
|
||||
}
|
||||
|
||||
public static function getInstance(): static
|
||||
|
||||
@@ -47,6 +47,7 @@ return [
|
||||
'server_software' => 'Web software',
|
||||
'load_average' => 'Server load average',
|
||||
'filament_version' => 'Filament version',
|
||||
'redis_version' => 'Redis version',
|
||||
],
|
||||
'latest_user' => [
|
||||
'page_title' => 'User latest',
|
||||
|
||||
@@ -47,6 +47,7 @@ return [
|
||||
'server_software' => 'Web 软件',
|
||||
'load_average' => '服务器平均负载',
|
||||
'filament_version' => 'Filament 版本',
|
||||
'redis_version' => 'Redis 版本',
|
||||
],
|
||||
'latest_user' => [
|
||||
'page_title' => '最新用户',
|
||||
|
||||
@@ -47,6 +47,7 @@ return [
|
||||
'server_software' => 'Web 軟件',
|
||||
'load_average' => '服務器平均負載',
|
||||
'filament_version' => 'Filament 版本',
|
||||
'redis_version' => 'Redis 版本',
|
||||
],
|
||||
'latest_user' => [
|
||||
'page_title' => '最新用戶',
|
||||
|
||||
Reference in New Issue
Block a user