Publier Globinours 1.0.0-rc.3
This commit is contained in:
parent
ea8c24d622
commit
9a2b4068da
325 changed files with 38230 additions and 20 deletions
28
scripts/asm3-plan.php
Normal file
28
scripts/asm3-plan.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env php
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
require dirname(__DIR__) . '/app/Services/DB.php';
|
||||
require dirname(__DIR__) . '/app/Services/Asm3Analyzer.php';
|
||||
require dirname(__DIR__) . '/app/Services/Asm3MigrationPlanner.php';
|
||||
$source = $argv[1] ?? null;
|
||||
$output = $argv[2] ?? null;
|
||||
if (!$source) {
|
||||
fwrite(STDERR, "Usage : php scripts/asm3-plan.php <dump.sql> [rapport.json]\n");
|
||||
exit(2);
|
||||
}
|
||||
try {
|
||||
$plan = Asm3MigrationPlanner::plan($source, DB::pdo());
|
||||
$json = json_encode($plan, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\n";
|
||||
} catch (Throwable $e) {
|
||||
fwrite(STDERR, "Erreur : {$e->getMessage()}\n");
|
||||
exit(1);
|
||||
}
|
||||
if ($output) {
|
||||
if (file_put_contents($output, $json) === false) {
|
||||
fwrite(STDERR, "Impossible d’écrire le rapport.\n");
|
||||
exit(1);
|
||||
}
|
||||
echo "Plan écrit dans {$output}\n";
|
||||
} else {
|
||||
echo $json;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue