move into sonardesk
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/** Static legacy route inventory; does not boot either application or require secrets. */
|
||||
$root = dirname(__DIR__, 2);
|
||||
$legacy = $root.'/integration/sonardesk-legacy';
|
||||
$files = glob($legacy.'/routes/*.php');
|
||||
foreach (glob($legacy.'/modules/*/Routes/*.php') ?: [] as $file) $files[] = $file;
|
||||
foreach (glob($legacy.'/modules/*/routes/*.php') ?: [] as $file) $files[] = $file;
|
||||
sort($files);
|
||||
$inventory = [];
|
||||
foreach ($files as $file) {
|
||||
$contents = file_get_contents($file);
|
||||
preg_match_all('/Route::(get|post|put|patch|delete|match|any)\s*\(\s*[\'\"]([^\'\"]+)/', $contents, $matches, PREG_SET_ORDER);
|
||||
foreach ($matches as $m) $inventory[] = ['method'=>strtoupper($m[1]), 'path'=>$m[2], 'source'=>substr($file, strlen($legacy)+1)];
|
||||
}
|
||||
$out = $root.'/integration/sonardesk-route-inventory.json';
|
||||
file_put_contents($out, json_encode(['generated_from'=>'archived SonarDesk source','warning'=>'Static extraction: nested prefixes, resource routes and dynamic registrations require runtime verification','routes'=>$inventory], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)."\n");
|
||||
fwrite(STDOUT, count($inventory)." static route declarations written to $out\n");
|
||||
Reference in New Issue
Block a user