From 1e3942f6094ddfc179c25095355a281231b3e74a Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Tue, 23 Jan 2024 22:21:26 +0300 Subject: [PATCH] no dump , logic for update --- utils.inc.php | 4 +++- yeswiki-updater.php | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/utils.inc.php b/utils.inc.php index 42e3fbe..e11d416 100644 --- a/utils.inc.php +++ b/utils.inc.php @@ -366,7 +366,9 @@ function searchWikis($path, $pattern) $responses = Future\awaitAll(array_map(function ($l) use ($httpClient) { return Amp\async(fn () => $httpClient->request(new Request($l['URL'], 'HEAD'))); }, $list)); - var_dump($responses[0]); + foreach ($responses[0] as $key => $response) { + $list[$key]['STATUS'] = 'ERROR'; + } foreach ($responses[1] as $key => $response) { $list[$key]['STATUS'] = $response->getStatus() . ' ' . $response->getReason(); } diff --git a/yeswiki-updater.php b/yeswiki-updater.php index abeb226..8a792d8 100755 --- a/yeswiki-updater.php +++ b/yeswiki-updater.php @@ -1,4 +1,4 @@ -#!/usr/bin/php +#!php 'u', 'longPrefix' => 'update', 'description' => 'Update to latest version of stable yeswiki', - 'defaultValue' => '0' + 'noValue' => true ], ]); try { @@ -52,6 +52,9 @@ if (0 == posix_getuid()) { $update = $climate->arguments->get('update'); $output = $climate->arguments->get('output'); $matches = searchWikis($path, 'wakka.config.php'); + if (count($matches) > 0 && $update) { + $climate->info('update'); + } $climate->info(count($matches) . ' yeswikis found on ' . $path); switch ($output) {