mirror of
https://github.com/Cacti/cacti.git
synced 2026-10-24 03:57:32 +09:00
* fix(installer): preserve upgrade state and propagate failures Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * docs(changelog): record installer recovery fixes for #8266 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test(security): refresh installer sink inventories Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(installer): retain merge precedence for browser parameters Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(installer): defer debug settings until the process lock is held Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * fix(installer): enforce table conversion failures and postconditions Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> * test(installer): refresh SQL audit baseline after clause refactor Signed-off-by: Thomas Vincent <thomasvincent@gmail.com> --------- Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
36 lines
1.5 KiB
PHP
36 lines
1.5 KiB
PHP
<?php
|
|
/*
|
|
+-------------------------------------------------------------------------+
|
|
| Copyright (C) 2004-2026 The Cacti Group |
|
|
+-------------------------------------------------------------------------+
|
|
*/
|
|
|
|
require_once CACTI_PATH_INSTALL . '/functions.php';
|
|
require_once CACTI_PATH_LIBRARY . '/installer.php';
|
|
|
|
test('installer commands preserve failed exit status and both output streams', function () {
|
|
$installer = (new ReflectionClass(Installer::class))->newInstanceWithoutConstructor();
|
|
$result = (new ReflectionMethod(Installer::class, 'runCommand'))->invoke($installer, [
|
|
PHP_BINARY,
|
|
'-r',
|
|
'fwrite(STDOUT, $argv[1] . PHP_EOL); fwrite(STDERR, "download failed\n"); exit(7);',
|
|
'literal argument; $(echo unexpected)',
|
|
]);
|
|
|
|
expect($result['exitCode'])->toBe(7)
|
|
->and($result['output'])->toContain('literal argument; $(echo unexpected)', 'download failed');
|
|
});
|
|
|
|
test('installer rejects unsupported request methods before loading application state', function () {
|
|
$installer = (new ReflectionClass(Installer::class))->newInstanceWithoutConstructor();
|
|
$result = (new ReflectionMethod(Installer::class, 'runCommand'))->invoke($installer, [
|
|
PHP_BINARY,
|
|
'-r',
|
|
'$_SERVER["REQUEST_METHOD"] = "GET"; register_shutdown_function(function () { echo " status=" . http_response_code(); }); require $argv[1];',
|
|
CACTI_PATH_INSTALL . '/step_json.php',
|
|
]);
|
|
|
|
expect($result['exitCode'])->toBe(0)
|
|
->and(implode(PHP_EOL, $result['output']))->toContain('Method not allowed', 'status=405');
|
|
});
|