false, 'error' => 'Missing path']); exit; } // Формируем Nextcloud путь $ncPath = '/admin/files/crm/' . $path; // Запускаем сканирование $command = "docker exec -u www-data nextcloud-fresh php occ files:scan --path=" . escapeshellarg($ncPath) . " 2>&1"; exec($command, $output, $returnCode); if ($returnCode === 0) { echo json_encode([ 'success' => true, 'message' => 'File indexed successfully', 'output' => implode("\n", $output) ]); } else { echo json_encode([ 'success' => false, 'error' => 'Indexing failed', 'output' => implode("\n", $output) ]); } ?>