feat(updater) : add count of yeswikis

This commit is contained in:
Florian Schmitt 2024-01-09 15:49:46 +03:00
parent b25aa91743
commit 7ebc4c0c1a
2 changed files with 8 additions and 1 deletions

View file

@ -343,11 +343,13 @@ function searchWikis($path, $pattern)
{ {
$it = new RecursiveDirectoryIterator($path); $it = new RecursiveDirectoryIterator($path);
$list = array(); $list = array();
$nb = 0;
foreach (new RecursiveIteratorIterator($it) as $file) { foreach (new RecursiveIteratorIterator($it) as $file) {
if (preg_match('/' . preg_quote($pattern) . '$/i', $file)) { if (preg_match('/' . preg_quote($pattern) . '$/i', $file)) {
$nb++;
$wakkaConfig = []; $wakkaConfig = [];
include_once($file); include_once($file);
$list[] = [ $list[$nb] = [
'URL' => $wakkaConfig['base_url'] ?? 'KO', 'URL' => $wakkaConfig['base_url'] ?? 'KO',
'VERSION' => $wakkaConfig['yeswiki_version'] ?? 'KO', 'VERSION' => $wakkaConfig['yeswiki_version'] ?? 'KO',
'RELEASE' => $wakkaConfig['yeswiki_release'] ?? 'KO', 'RELEASE' => $wakkaConfig['yeswiki_release'] ?? 'KO',
@ -372,3 +374,7 @@ function searchWikis($path, $pattern)

View file

@ -45,6 +45,7 @@ if (0 == posix_getuid()) {
$update = $climate->arguments->get('update'); $update = $climate->arguments->get('update');
$output = $climate->arguments->get('output'); $output = $climate->arguments->get('output');
$matches = searchWikis($path, 'wakka.config.php'); $matches = searchWikis($path, 'wakka.config.php');
$climate->info(count($matches) . ' yeswikis found on ' . $path);
switch ($output) { switch ($output) {
case 'table': case 'table':