fix: static

This commit is contained in:
hashbro
2026-09-14 04:12:54 +08:00
parent d16c40cdb3
commit 233df72502
6 changed files with 320 additions and 52 deletions
+19
View File
@@ -19,10 +19,29 @@ class ScanPhotoMnemonic implements ShouldQueue
public function handle(MnemonicScanService $scan): void
{
$this->raiseMemoryLimit();
$photo = Photo::query()->with('device')->find($this->photoId);
if ($photo === null) {
return;
}
$scan->scanPhoto($photo);
}
private function raiseMemoryLimit(): void
{
$raw = strtolower(trim((string) ini_get('memory_limit')));
if ($raw === '' || $raw === '-1') {
return;
}
$n = (int) $raw;
$bytes = match (substr($raw, -1)) {
'g' => $n * 1024 * 1024 * 1024,
'm' => $n * 1024 * 1024,
'k' => $n * 1024,
default => (int) $raw,
};
if ($bytes > 0 && $bytes < 256 * 1024 * 1024) {
ini_set('memory_limit', '256M');
}
}
}