Files
wevads-platform/scripts/api_symlink-check.php
2026-02-26 04:53:11 +01:00

45 lines
1.6 KiB
PHP
Executable File

<?php
header('Content-Type: application/json');
function findSymlinks($dir) {
$symlinks = [];
$iterator = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST
);
foreach ($iterator as $file) {
if ($file->isLink()) {
$symlinks[] = [
'name' => basename($file->getPathname()),
'path' => $file->getPathname(),
'target' => readlink($file->getPathname())
];
}
}
return $symlinks;
}
$arsenalDir = '/opt/wevads-arsenal/public';
$adxDir = '/opt/wevads/public';
$arsenalSymlinks = findSymlinks($arsenalDir);
$adxSymlinks = findSymlinks($adxDir);
echo json_encode([
'status' => 'success',
'data' => [
'arsenal_symlinks' => $arsenalSymlinks,
'adx_symlinks' => $adxSymlinks,
'total_symlinks' => count($arsenalSymlinks) + count($adxSymlinks),
'shared_apis' => [
'mta.php' => file_exists('/opt/wevads-arsenal/public/api/mta.php') && is_link('/opt/wevads-arsenal/public/api/mta.php'),
'tracking_api.php' => file_exists('/opt/wevads-arsenal/public/api/tracking_api.php') && is_link('/opt/wevads-arsenal/public/api/tracking_api.php'),
'brain_unified_send.php' => file_exists('/opt/wevads-arsenal/public/api/brain_unified_send.php'),
'health-check.php' => file_exists('/opt/wevads-arsenal/public/api/health-check.php'),
'offer-engine.php' => file_exists('/opt/wevads-arsenal/public/api/offer-engine.php')
]
]
]);
?>