Files
michaelschiemer/scripts/debug/debug_routes.php
Michael Schiemer 887847dde6 refactor: reorganize project structure for better maintainability
- Move 45 debug/test files from root to organized scripts/ directories
- Secure public/ directory by removing debug files (security improvement)
- Create structured scripts organization:
  • scripts/debug/      (20 files) - Framework debugging tools
  • scripts/test/       (18 files) - Test and validation scripts
  • scripts/maintenance/ (5 files) - Maintenance utilities
  • scripts/dev/         (2 files) - Development tools

Security improvements:
- Removed all debug/test files from public/ directory
- Only production files remain: index.php, health.php

Root directory cleanup:
- Reduced from 47 to 2 PHP files in root
- Only essential production files: console.php, worker.php

This improves:
 Security (no debug code in public/)
 Organization (clear separation of concerns)
 Maintainability (easy to find and manage scripts)
 Professional structure (clean root directory)
2025-10-05 10:59:15 +02:00

56 lines
1.9 KiB
PHP

<?php
require '/var/www/html/vendor/autoload.php';
use App\Framework\Discovery\DiscoveryServiceBootstrapper;
use App\Framework\DI\DefaultContainer;
use App\Framework\Attributes\Route;
try {
echo "=== Route Discovery Diagnostic ===\n";
$container = new DefaultContainer();
$bootStrapper = new DiscoveryServiceBootstrapper();
$bootStrapper->initialize($container);
$registry = $container->get('App\Framework\Discovery\Results\DiscoveryRegistry');
$routes = $registry->attributes->get(Route::class);
echo "Total routes found: " . count($routes) . "\n\n";
$adminRoutes = [];
foreach ($routes as $route) {
$path = $route->additionalData['path'] ?? '';
if (str_contains($path, 'admin')) {
$adminRoutes[] = [
'path' => $path,
'controller' => $route->className->getFullyQualified(),
'method' => $route->methodName?->toString() ?? 'unknown'
];
}
}
echo "Admin routes found:\n";
foreach ($adminRoutes as $route) {
echo " Path: {$route['path']}\n";
echo " Controller: {$route['controller']}\n";
echo " Method: {$route['method']}\n";
echo " ---\n";
}
// Check specifically for ShowRoutes
echo "\nLooking for ShowRoutes controller:\n";
foreach ($routes as $route) {
if (str_contains($route->className->getFullyQualified(), 'ShowRoutes')) {
echo "Found ShowRoutes route:\n";
echo " Path: " . ($route->additionalData['path'] ?? 'unknown') . "\n";
echo " Controller: " . $route->className->getFullyQualified() . "\n";
echo " Method: " . ($route->methodName?->toString() ?? 'unknown') . "\n";
break;
}
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
echo "Stack trace: " . $e->getTraceAsString() . "\n";
}