- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
82 lines
3.0 KiB
PHP
82 lines
3.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/autoloader_workaround.php';
|
|
|
|
use App\Framework\Console\ConsoleCommand;
|
|
|
|
echo "=== DISCOVERY DEBUG ===\n\n";
|
|
|
|
// Try to discover ConsoleCommand attributes directly
|
|
try {
|
|
echo "1. Testing Discovery Service...\n";
|
|
|
|
// Create a simple attribute discovery test
|
|
$container = new App\Framework\DI\DefaultContainer();
|
|
|
|
// We need to check what the current Discovery system finds
|
|
$pathProvider = new App\Framework\Core\PathProvider('/var/www/html');
|
|
$cache = new App\Framework\Cache\MemoryCache();
|
|
$clock = new App\Framework\DateTime\SystemClock();
|
|
$reflectionProvider = new App\Framework\Core\CachedReflectionProvider();
|
|
|
|
// Create discovery configuration
|
|
$config = new App\Framework\Discovery\ValueObjects\DiscoveryConfiguration(
|
|
paths: ['/var/www/html/src'],
|
|
useCache: false, // Disable cache for debugging
|
|
enableMemoryMonitoring: false,
|
|
enablePerformanceTracking: true,
|
|
maxFilesPerBatch: 50,
|
|
memoryLimitMB: 128,
|
|
memoryPressureThreshold: 0.8,
|
|
cacheTimeout: App\Framework\Core\ValueObjects\Duration::fromHours(1)
|
|
);
|
|
|
|
echo "2. Discovery configuration created\n";
|
|
|
|
$discoveryService = new App\Framework\Discovery\UnifiedDiscoveryService(
|
|
pathProvider: $pathProvider,
|
|
cache: $cache,
|
|
clock: $clock,
|
|
reflectionProvider: $reflectionProvider,
|
|
configuration: $config,
|
|
attributeMappers: [ConsoleCommand::class],
|
|
targetInterfaces: []
|
|
);
|
|
|
|
echo "3. Discovery service created\n";
|
|
|
|
// Perform discovery
|
|
echo "4. Starting discovery...\n";
|
|
$registry = $discoveryService->discover();
|
|
|
|
echo "5. Discovery completed!\n";
|
|
echo " Total items found: " . count($registry) . "\n";
|
|
echo " Attributes: " . count($registry->attributes) . "\n";
|
|
|
|
// Get ConsoleCommand attributes specifically
|
|
if ($registry->attributes->has(ConsoleCommand::class)) {
|
|
$consoleCommands = $registry->attributes->get(ConsoleCommand::class);
|
|
echo " ConsoleCommands found: " . count($consoleCommands) . "\n\n";
|
|
|
|
echo "=== FOUND CONSOLE COMMANDS ===\n";
|
|
foreach ($consoleCommands as $i => $command) {
|
|
echo ($i + 1) . ". Class: " . ($command['class'] ?? 'unknown') . "\n";
|
|
echo " Name: " . ($command['attribute']->name ?? 'unknown') . "\n";
|
|
echo " Description: " . ($command['attribute']->description ?? 'none') . "\n\n";
|
|
}
|
|
} else {
|
|
echo " NO ConsoleCommand attributes found!\n";
|
|
}
|
|
|
|
echo "\n=== MEMORY STATS ===\n";
|
|
$memStats = $registry->getMemoryStats();
|
|
echo "Total estimated bytes: " . $memStats['total_estimated_bytes'] . "\n";
|
|
echo "Attributes count: " . count($registry->attributes) . "\n";
|
|
|
|
} catch (Throwable $e) {
|
|
echo "ERROR: " . $e->getMessage() . "\n";
|
|
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
echo "Trace:\n" . $e->getTraceAsString() . "\n";
|
|
} |