fix: static
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user