update php Dockerfile

This commit is contained in:
xiaomlove
2025-05-06 11:18:48 +07:00
parent 9a3daabf18
commit ea0f49bc46
5 changed files with 29 additions and 7 deletions

View File

@@ -12,7 +12,8 @@ RUN apk add --no-cache \
libwebp-dev \
gmp-dev \
oniguruma-dev \
linux-headers
linux-headers \
curl
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
@@ -28,8 +29,15 @@ RUN docker-php-ext-install -j$(nproc) \
intl \
opcache
# 检查 pecl.php.net 可用性
RUN curl -Is https://pecl.php.net | head -n 1 | grep "200" \
|| (echo "❌ pecl.php.net unreachable, aborting build." && exit 1)
# 安装 redis 扩展
RUN pecl install redis && docker-php-ext-enable redis
RUN pecl channel-update pecl.php.net \
&& pecl install redis \
&& docker-php-ext-enable redis
# 👨‍🍳 第二阶段:运行阶段,仅包含必要运行环境
FROM php:8.2-fpm-alpine

View File

@@ -34,7 +34,7 @@ class PluginStoreResource extends Resource
public static function getNavigationBadge(): ?string
{
return PluginStore::getHasNewVersionCount();
return PluginStore::getHasNewVersionCount() ?: '';
}
public static function form(Form $form): Form

View File

@@ -4,6 +4,8 @@ namespace App\Models;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\HtmlString;
@@ -102,7 +104,12 @@ class PluginStore extends Model
private static function listAllFromRemote()
{
$list = Http::get(self::PLUGIN_LIST_API)->json();
$response = Http::get(self::PLUGIN_LIST_API);
if ($response->getStatusCode() != 200) {
do_log(sprintf("status code: %d, body: %s", $response->getStatusCode(), $response->getBody()), 'error');
return [];
}
$list = $response->json();
foreach ($list as &$row) {
foreach ($row as $key => $value) {
if (is_array($value)) {
@@ -115,6 +122,9 @@ class PluginStore extends Model
public static function getHasNewVersionCount(): int
{
if (!Gate::allows('viewAny', PluginStore::class)) {
return 0;
}
$currentRouteName = Route::currentRouteName();
$withoutCacheRouteName = ['filament.admin.resources.system.plugin-stores.index', 'filament.admin.pages.dashboard'];
$list = self::listAll(in_array($currentRouteName, $withoutCacheRouteName));

View File

@@ -277,11 +277,15 @@ class User extends Authenticatable implements FilamentUser, HasName
public function checkIsNormal(array $fields = ['status', 'enabled']): bool
{
$params = [
'user_id' => $this->id,
'username' => $this->username,
];
if (in_array('status', $fields) && $this->getAttribute('status') != self::STATUS_CONFIRMED) {
throw new NexusException(nexus_trans("user.user_is_not_confirmed", ['user_id' => $this->id, 'username' => $this->username]));
throw new NexusException(nexus_trans("user.user_is_not_confirmed", $params));
}
if (in_array('enabled', $fields) && $this->getAttribute('enabled') != self::ENABLED_YES) {
throw new NexusException(nexus_trans("user.user_is_disabled", ['user_id' => $this->id, 'username' => $this->username]));
throw new NexusException(nexus_trans("user.user_is_disabled", $params));
}
return true;
}

View File

@@ -109,6 +109,6 @@ return [
'msg_invited_user_has_registered' => "你邀请的用户已注册",
'msg_user_you_invited' => "你邀请的用户 ",
'msg_has_registered' => " 刚刚已注册。",
'user_is_disabled' => '用户::username(ID: :user_id) 已被封禁',
'user_is_not_disabled' => '用户::username(ID: :user_id) 已被封禁',
'user_is_not_confirmed' => '用户::username(ID: :user_id) 未确认',
];