feat(updater): better num version + backup parameter bis
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Florian Schmitt 2025-03-27 13:09:11 +03:00
parent 3020238f96
commit 107bd64253

View file

@ -39,6 +39,12 @@ if ($isRoot) {
'description' => 'Update to latest version of stable yeswiki', 'description' => 'Update to latest version of stable yeswiki',
'noValue' => true 'noValue' => true
], ],
'backup' => [
'prefix' => 'b',
'longPrefix' => 'backup',
'description' => 'Save a backup in /root/yeswiki_backups folder before upgrading the yeswiki',
'defaultValue' => true
],
'depth' => [ 'depth' => [
'prefix' => 'd', 'prefix' => 'd',
'longPrefix' => 'depth', 'longPrefix' => 'depth',
@ -60,6 +66,7 @@ if ($isRoot) {
try { try {
$update = $climate->arguments->get('update'); $update = $climate->arguments->get('update');
$output = $climate->arguments->get('output'); $output = $climate->arguments->get('output');
$backup = $climate->arguments->get('backup');
$depth = $climate->arguments->get('depth'); $depth = $climate->arguments->get('depth');
$matches = searchWikis($path, 'wakka.config.php', $depth); $matches = searchWikis($path, 'wakka.config.php', $depth);
if (count($matches) == 0) { if (count($matches) == 0) {
@ -87,11 +94,10 @@ if ($isRoot) {
} elseif ($wiki['RELEASE'] == $version) { } elseif ($wiki['RELEASE'] == $version) {
$climate->info('Skipping up-to-date wiki '.$wiki['URL']); $climate->info('Skipping up-to-date wiki '.$wiki['URL']);
} else { } else {
$climate->info(upgradeWiki($destDir, $wiki['PATH'])); $climate->info(upgradeWiki($destDir, $wiki['PATH'], $backup));
} }
} }
} else { // show yeswiki list info } else { // show yeswiki list info
$climate->info(count($matches) . ' yeswikis found on ' . $path);
switch ($output) { switch ($output) {
case 'table': case 'table':