Enable Discovery debug logging for production troubleshooting

- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -1,8 +1,10 @@
<?php
declare(strict_types=1);
namespace App\Framework\Filesystem;
use App\Framework\Async\FiberManager;
use App\Framework\Filesystem\Exceptions\DirectoryCreateException;
use App\Framework\Filesystem\Exceptions\FileNotFoundException;
use App\Framework\Filesystem\Exceptions\FileReadException;
@@ -21,9 +23,28 @@ final class InMemoryStorage implements Storage
/** @var array<string, int> */
private array $timestamps = [];
public readonly PermissionChecker $permissions;
public readonly FiberManager $fiberManager;
public function __construct()
{
$this->permissions = new PermissionChecker($this);
$this->fiberManager = $this->createDefaultFiberManager();
}
private function createDefaultFiberManager(): FiberManager
{
// Create minimal dependencies for FiberManager
$clock = new \App\Framework\DateTime\SystemClock();
$timer = new \App\Framework\DateTime\SystemTimer($clock);
return new FiberManager($clock, $timer);
}
public function get(string $path): string
{
if (!isset($this->files[$path])) {
if (! isset($this->files[$path])) {
throw new FileNotFoundException($path);
}
@@ -33,7 +54,7 @@ final class InMemoryStorage implements Storage
public function put(string $path, string $content): void
{
$dir = dirname($path);
if (!isset($this->directories[$dir])) {
if (! isset($this->directories[$dir])) {
$this->createDirectory($dir);
}
@@ -48,7 +69,7 @@ final class InMemoryStorage implements Storage
public function delete(string $path): void
{
if (!isset($this->files[$path])) {
if (! isset($this->files[$path])) {
throw new FileNotFoundException($path);
}
@@ -58,12 +79,12 @@ final class InMemoryStorage implements Storage
public function copy(string $source, string $destination): void
{
if (!isset($this->files[$source])) {
if (! isset($this->files[$source])) {
throw new FileNotFoundException($source);
}
$dir = dirname($destination);
if (!isset($this->directories[$dir])) {
if (! isset($this->directories[$dir])) {
$this->createDirectory($dir);
}
@@ -73,7 +94,7 @@ final class InMemoryStorage implements Storage
public function size(string $path): int
{
if (!isset($this->files[$path])) {
if (! isset($this->files[$path])) {
throw new FileNotFoundException($path);
}
@@ -82,7 +103,7 @@ final class InMemoryStorage implements Storage
public function lastModified(string $path): int
{
if (!isset($this->files[$path])) {
if (! isset($this->files[$path])) {
throw new FileNotFoundException($path);
}
@@ -91,7 +112,7 @@ final class InMemoryStorage implements Storage
public function listDirectory(string $directory): array
{
if (!isset($this->directories[$directory])) {
if (! isset($this->directories[$directory])) {
throw new DirectoryCreateException($directory);
}
@@ -104,7 +125,7 @@ final class InMemoryStorage implements Storage
if (str_starts_with($path, $prefix)) {
// Nur direkte Kinder, keine tieferen Ebenen
$relativePath = substr($path, $prefixLength);
if (!str_contains($relativePath, DIRECTORY_SEPARATOR)) {
if (! str_contains($relativePath, DIRECTORY_SEPARATOR)) {
$result[] = $path;
}
}
@@ -115,7 +136,7 @@ final class InMemoryStorage implements Storage
if ($path !== $directory && strpos($path, $prefix) === 0) {
// Nur direkte Kinder
$relativePath = substr($path, $prefixLength);
if (!str_contains($relativePath, DIRECTORY_SEPARATOR)) {
if (! str_contains($relativePath, DIRECTORY_SEPARATOR)) {
$result[] = $path;
}
}
@@ -180,7 +201,7 @@ final class InMemoryStorage implements Storage
public function getMimeType(string $path): string
{
if (!isset($this->files[$path])) {
if (! isset($this->files[$path])) {
throw new FileNotFoundException($path);
}
@@ -204,4 +225,45 @@ final class InMemoryStorage implements Storage
{
return true;
}
public function batch(array $operations): array
{
return $this->fiberManager->batch($operations);
}
public function getMultiple(array $paths): array
{
$operations = [];
foreach ($paths as $path) {
$operations[$path] = fn () => $this->get($path);
}
return $this->batch($operations);
}
public function putMultiple(array $files): void
{
$operations = [];
foreach ($files as $path => $content) {
$operations[$path] = fn () => $this->put($path, $content);
}
$this->batch($operations);
}
public function getMetadataMultiple(array $paths): array
{
$operations = [];
foreach ($paths as $path) {
$operations[$path] = fn () => new FileMetadata(
path: $path,
size: $this->size($path),
lastModified: $this->lastModified($path),
mimeType: $this->getMimeType($path),
isReadable: $this->isReadable($path),
isWritable: $this->isWritable($path)
);
}
return $this->batch($operations);
}
}