Address LaySite 1.4.0 review findings

This commit is contained in:
2026-11-26 01:50:58 +08:00
parent 2e9b5fa17c
commit 85583b3c87
7 changed files with 32 additions and 9 deletions
+11
View File
@@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace App\Content;
use RuntimeException;
final class UpdateCheckInProgress extends RuntimeException
{
}
+5 -2
View File
@@ -33,9 +33,12 @@ final class Updates
throw new RuntimeException('无法打开版本检查缓存。');
}
try {
if (!flock($lock, LOCK_EX | LOCK_NB)) {
if (!flock($lock, LOCK_EX | LOCK_NB, $wouldBlock)) {
if (!$wouldBlock) {
throw new RuntimeException('无法锁定版本检查缓存。');
}
if (!array_key_exists('latest', $record)) {
throw new RuntimeException('版本检查正在进行,请稍后重试。');
throw new UpdateCheckInProgress('版本检查正在进行,请稍后重试。');
}
} else {
$record = self::cached($path);