WIP historical updates registry

This commit is contained in:
fbsanchez 2022-03-29 20:58:18 +02:00
parent dd1768535d
commit dc2d577def
2 changed files with 23 additions and 4 deletions

View File

@ -35,6 +35,7 @@
global $config;
require_once $config['homedir'].'/vendor/autoload.php';
require_once $config['homedir'].'/include/functions_update_manager.php';
use PandoraFMS\Enterprise\Metaconsole\Synchronizer;
use UpdateManager\UI\Manager;
@ -413,6 +414,9 @@ $ui = new Manager(
'clear_maintenance_mode' => function () {
config_update_value('maintenance_mode', 0);
},
'on_update' => function ($version, $type) use ($mode) {
register_upgrade($version, $type, $mode);
},
],
$mode,
true

View File

@ -216,10 +216,10 @@ function update_manager_get_config_values()
'language' => $config['language'],
'timezone' => $config['timezone'],
'proxy' => [
'host' => $config['update_manager_proxy_host'],
'port' => $config['update_manager_proxy_port'],
'user' => $config['update_manager_proxy_user'],
'password' => $config['update_manager_proxy_password'],
'host' => ($config['update_manager_proxy_host'] ?? null),
'port' => ($config['update_manager_proxy_port'] ?? null),
'user' => ($config['update_manager_proxy_user'] ?? null),
'password' => ($config['update_manager_proxy_password'] ?? null),
],
];
}
@ -269,3 +269,18 @@ function rrmdir($dir)
unlink($dir);
}
}
/**
* Keeps an history of upgrades.
*
* @param string $version Version installed.
* @param string $type Package type (server|console).
* @param string $mode Installation style (offline|online).
*
* @return void
*/
function register_upgrade($version, $type, $mode)
{
error_log(__('Installed %s version (%s) %s', $version, $type, $mode));
}