feat(updater): count the wikis
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Florian Schmitt 2025-03-27 14:19:55 +03:00
parent a5c6a74f2b
commit 48ff8144fe

View file

@ -74,7 +74,7 @@ if ($isRoot) {
exit;
}
if (count($matches) > 0 && $update) { // update yeswiki list
$climate->info('Update all listed yeswikis');
$climate->info('Update all '.count($matches).' yeswikis found');
$tmpFile = '/tmp/yeswiki.zip';
$destDir = '/tmp/yeswiki_for_update';
exec('rm -rf ' . $destDir . ' && mkdir -p ' . $destDir, $output);
@ -88,12 +88,15 @@ if ($isRoot) {
unlink($tmpFile);
// get latest yeswiki version
$version = trim(cli("cat $destDir/includes/constants.php | grep YESWIKI_RELEASE | sed -r -e \"s/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/\""));
$nb = 0;
foreach ($matches as $k => $wiki) {
$nb = $nb + 1;
if ($wiki['VERSION'] != 'doryphore') {
$climate->red('Skipping non doryphore version wiki '.$wiki['URL']);
$climate->info($nb.' - skipping non doryphore version wiki '.$wiki['URL']);
} elseif ($wiki['RELEASE'] == $version) {
$climate->info('Skipping up-to-date wiki '.$wiki['URL']);
$climate->info($nb.' - skipping up-to-date wiki '.$wiki['URL']);
} else {
$climate->info($nb.' - upgrading wiki '.$wiki['URL']);
$climate->info(upgradeWiki($destDir, $wiki['PATH'], $nobackup));
}
}