Linux cesa-www-main 6.1.0-49-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
Apache/2.4.68 (Debian)
Server IP : 10.218.0.2 & Your IP : 216.73.217.79
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
v3.cesa.co.za /
scripts /
Delete
Unzip
Name
Size
Permission
Date
Action
.htaccess
237
B
-r-xr-xr-x
2026-08-17 03:12
remove-orphan-api-platform-config.php
3.29
KB
-rwxrwxr-x
2026-05-18 12:51
Save
Rename
<?php /** * Removes Api Platform leftovers when the package is not fully installed. * * Typical server state after a failed or partial install: * - config/packages/api_platform.yaml * - config/routes/api_platform.yaml (type: api_platform → Loader error) * - ApiPlatformBundle still listed in config/bundles.php (Twig paths → missing vendor views) * - Broken vendor/api-platform/ directory */ $projectDir = dirname(__DIR__); if (isApiPlatformInstalled($projectDir)) { return; } $orphanFiles = [ $projectDir . '/config/packages/api_platform.yaml', $projectDir . '/config/packages/dev/api_platform.yaml', $projectDir . '/config/packages/prod/api_platform.yaml', $projectDir . '/config/packages/test/api_platform.yaml', $projectDir . '/config/routes/api_platform.yaml', $projectDir . '/config/routes/dev/api_platform.yaml', $projectDir . '/config/routes/prod/api_platform.yaml', ]; foreach ($orphanFiles as $file) { removeFileIfExists($file); } removeApiPlatformFromBundlesPhp($projectDir . '/config/bundles.php'); stripApiPlatformImportsFromRoutesYaml($projectDir . '/config/routes.yaml'); $brokenVendor = $projectDir . '/vendor/api-platform'; if (is_dir($brokenVendor) && !isApiPlatformInstalled($projectDir)) { removeDirectory($brokenVendor); fwrite(STDERR, sprintf("Removed broken vendor tree: %s\n", $brokenVendor)); } function isApiPlatformInstalled(string $projectDir): bool { return is_file($projectDir . '/vendor/api-platform/symfony/Bundle/ApiPlatformBundle.php') && is_dir($projectDir . '/vendor/api-platform/symfony/Bundle/Resources/views'); } function removeFileIfExists(string $file): void { if (!is_file($file)) { return; } unlink($file); fwrite(STDERR, sprintf("Removed orphan Api Platform config: %s\n", $file)); } function removeApiPlatformFromBundlesPhp(string $bundlesFile): void { if (!is_file($bundlesFile)) { return; } $lines = file($bundlesFile, FILE_IGNORE_NEW_LINES); if ($lines === false) { return; } $filtered = array_values(array_filter( $lines, static fn (string $line): bool => !preg_match('/ApiPlatform\\\\/i', $line) )); if (count($filtered) === count($lines)) { return; } file_put_contents($bundlesFile, implode("\n", $filtered) . "\n"); fwrite(STDERR, "Removed Api Platform bundle entry from config/bundles.php\n"); } function stripApiPlatformImportsFromRoutesYaml(string $routesFile): void { if (!is_file($routesFile)) { return; } $content = file_get_contents($routesFile); $updated = preg_replace('/^[ \t-]*.*api_platform.*\n/m', '', $content); if ($updated === null || $updated === $content) { return; } file_put_contents($routesFile, $updated); fwrite(STDERR, "Removed Api Platform imports from config/routes.yaml\n"); } function removeDirectory(string $dir): void { if (!is_dir($dir)) { return; } $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($iterator as $item) { if ($item->isDir()) { rmdir($item->getPathname()); } else { unlink($item->getPathname()); } } rmdir($dir); }