diff --git a/pandora_console/extras/mr/53.sql b/pandora_console/extras/mr/53.sql
index dfb7976a91..86553a4e34 100644
--- a/pandora_console/extras/mr/53.sql
+++ b/pandora_console/extras/mr/53.sql
@@ -15,5 +15,17 @@ CREATE TABLE IF NOT EXISTS `tbackup` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
+DROP TABLE `tupdate`;
+DROP TABLE `tupdate_package`;
+DROP TABLE `tupdate_journal`;
+
+CREATE TABLE `tupdate_journal` (
+ `id` SERIAL,
+ `utimestamp` BIGINT DEFAULT 0,
+ `version` VARCHAR(25) DEFAULT '',
+ `type` VARCHAR(25) DEFAULT '',
+ `origin` VARCHAR(25) DEFAULT '',
+ `id_user` VARCHAR(250) NOT NULL DEFAULT ''
+) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;
COMMIT;
diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php
index de991dcfe2..aeecc25273 100644
--- a/pandora_console/godmode/menu.php
+++ b/pandora_console/godmode/menu.php
@@ -535,9 +535,13 @@ if (check_acl($config['id_user'], 0, 'PM') && $config['enable_update_manager'])
$sub['godmode/update_manager/update_manager&tab=online']['text'] = __('Update Manager online');
$sub['godmode/update_manager/update_manager&tab=online']['id'] = 'Online';
+
$sub['godmode/update_manager/update_manager&tab=setup']['text'] = __('Update Manager options');
$sub['godmode/update_manager/update_manager&tab=setup']['id'] = 'Options';
+ $sub['godmode/update_manager/update_manager&tab=history']['text'] = __('Update Manager journal');
+ $sub['godmode/update_manager/update_manager&tab=history']['id'] = 'Journal';
+
$menu_godmode['messages']['sub'] = $sub;
}
diff --git a/pandora_console/godmode/update_manager/update_manager.history.php b/pandora_console/godmode/update_manager/update_manager.history.php
new file mode 100644
index 0000000000..84e1d57897
--- /dev/null
+++ b/pandora_console/godmode/update_manager/update_manager.history.php
@@ -0,0 +1,79 @@
+ $tableId,
+ 'class' => 'info_table',
+ 'style' => 'width: 100%',
+ 'columns' => $columns,
+ 'column_names' => $column_names,
+ 'ajax_url' => 'include/ajax/update_manager',
+ 'ajax_data' => ['method' => 'draw'],
+ 'no_sortable_columns' => [],
+ 'order' => [
+ 'field' => 'utimestamp',
+ 'direction' => 'desc',
+ ],
+ 'search_button_class' => 'sub filter float-right',
+ 'form' => [
+ 'inputs' => [
+ [
+ 'label' => __('Free search'),
+ 'type' => 'text',
+ 'class' => 'mw250px',
+ 'id' => 'free_search',
+ 'name' => 'free_search',
+ ],
+ ],
+ ],
+ ]
+ );
+} catch (Exception $e) {
+ echo $e->getMessage();
+}
diff --git a/pandora_console/godmode/update_manager/update_manager.php b/pandora_console/godmode/update_manager/update_manager.php
index afd545434f..fd9906cabe 100644
--- a/pandora_console/godmode/update_manager/update_manager.php
+++ b/pandora_console/godmode/update_manager/update_manager.php
@@ -15,7 +15,7 @@ global $config;
check_login();
// The ajax is in
-// include/ajax/update_manager.ajax.php
+// include/ajax/update_manager.php
if (! check_acl($config['id_user'], 0, 'PM') && ! is_user_admin($config['id_user'])) {
db_pandora_audit(
AUDIT_LOG_ACL_VIOLATION,
@@ -37,20 +37,32 @@ $tab = get_parameter('tab', 'online');
$buttons['setup'] = [
'active' => ($tab == 'setup') ? true : false,
- 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'',
+ 'text' => ''.html_print_image('images/gm_setup.png', true, ['title' => __('Options'), 'class' => 'invert_filter']).'',
+];
+
+$buttons['history'] = [
+ 'active' => ($tab == 'history') ? true : false,
+ 'text' => ''.html_print_image('images/gm_db.png', true, ['title' => __('Journal'), 'class' => 'invert_filter']).'',
];
$buttons['offline'] = [
'active' => ($tab == 'offline') ? true : false,
- 'text' => ''.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'',
+ 'text' => ''.html_print_image('images/box.png', true, ['title' => __('Offline update manager'), 'class' => 'invert_filter']).'',
];
$buttons['online'] = [
'active' => ($tab == 'online') ? true : false,
- 'text' => ''.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager'), 'class' => 'invert_filter']).'',
+ 'text' => ''.html_print_image('images/op_gis.png', true, ['title' => __('Online update manager'), 'class' => 'invert_filter']).'',
];
-
switch ($tab) {
case 'setup':
$title = __('Update manager ยป Setup');
@@ -76,6 +88,10 @@ ui_print_page_header(
);
switch ($tab) {
+ case 'history':
+ include $config['homedir'].'/godmode/update_manager/update_manager.history.php';
+ break;
+
case 'setup':
include $config['homedir'].'/godmode/update_manager/update_manager.setup.php';
break;
diff --git a/pandora_console/include/ajax/update_manager.php b/pandora_console/include/ajax/update_manager.php
new file mode 100644
index 0000000000..4e6eefdfd3
--- /dev/null
+++ b/pandora_console/include/ajax/update_manager.php
@@ -0,0 +1,174 @@
+ 0
+ && isset($length) && $length >= 0
+ ) {
+ $pagination = sprintf(
+ ' LIMIT %d OFFSET %d ',
+ $start,
+ $length
+ );
+ }
+
+ try {
+ ob_start();
+
+ $fields = ['*'];
+ $sql_filters = [];
+
+ if (isset($filter['free_search']) === true
+ && empty($filter['free_search']) === false
+ ) {
+ $sql_filters[] = sprintf(
+ ' AND (`id_user` like "%%%s%%" OR `version` like "%%%s%%") ',
+ $filter['free_search'],
+ $filter['free_search']
+ );
+ }
+
+ if (isset($order) === true) {
+ $dir = 'asc';
+ if ($order == 'desc') {
+ $dir = 'desc';
+ };
+
+ if (in_array(
+ $sort_field,
+ [
+ 'version',
+ 'type',
+ 'id_user',
+ 'utimestamp',
+ ]
+ ) === true
+ ) {
+ $order_by = sprintf(
+ 'ORDER BY `%s` %s',
+ $sort_field,
+ $dir
+ );
+ }
+ }
+
+ // Retrieve data.
+ $sql = sprintf(
+ 'SELECT %s
+ FROM tupdate_journal
+ WHERE 1=1
+ %s
+ %s
+ %s',
+ join(',', $fields),
+ join(' ', $sql_filters),
+ $order_by,
+ $pagination
+ );
+
+ $return = db_get_all_rows_sql($sql);
+ if ($return === false) {
+ $data = [];
+ } else {
+ $data = $return;
+ }
+
+ // Retrieve counter.
+ $count = db_get_value('count(*)', '('.$sql.') t');
+
+ if ($data) {
+ $data = array_reduce(
+ $data,
+ function ($carry, $item) {
+ // Transforms array of arrays $data into an array
+ // of objects, making a post-process of certain fields.
+ $tmp = (object) $item;
+
+ $tmp->utimestamp = human_time_comparation($tmp->utimestamp);
+
+ $carry[] = $tmp;
+ return $carry;
+ }
+ );
+ }
+
+ // Datatables format: RecordsTotal && recordsfiltered.
+ echo json_encode(
+ [
+ 'data' => $data,
+ 'recordsTotal' => $count,
+ 'recordsFiltered' => $count,
+ ]
+ );
+ // Capture output.
+ $response = ob_get_clean();
+ } catch (Exception $e) {
+ echo json_encode(['error' => $e->getMessage()]);
+ exit;
+ }
+
+ // If not valid, show error with issue.
+ json_decode($response);
+ if (json_last_error() == JSON_ERROR_NONE) {
+ // If valid dump.
+ echo $response;
+ } else {
+ echo json_encode(
+ ['error' => $response]
+ );
+ }
+
+ exit;
+}
diff --git a/pandora_console/include/constants.php b/pandora_console/include/constants.php
index c1da547d0a..9ce88f718a 100644
--- a/pandora_console/include/constants.php
+++ b/pandora_console/include/constants.php
@@ -802,6 +802,7 @@ define('AUDIT_LOG_SNMP_MANAGEMENT', 'SNMP management');
define('AUDIT_LOG_DASHBOARD_MANAGEMENT', 'Dashboard management');
define('AUDIT_LOG_SERVICE_MANAGEMENT', 'Service management');
define('AUDIT_LOG_INCIDENT_MANAGEMENT', 'Incident management');
+define('AUDIT_LOG_UMC', 'Update Manager');
// MIMEs.
define(
diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php
index a53246c071..66fad11692 100644
--- a/pandora_console/include/functions_html.php
+++ b/pandora_console/include/functions_html.php
@@ -4760,6 +4760,7 @@ function html_print_input($data, $wrapper='div', $input_only=false)
enterprise_include_once('include/functions_metaconsole.php');
+ $style = '';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
$style = 'style="color: white"';
}
@@ -4768,9 +4769,9 @@ function html_print_input($data, $wrapper='div', $input_only=false)
if (($data['label'] ?? false) && $input_only === false) {
$output = '<'.$wrapper.' id="'.$wrapper.'-'.$data['name'].'" ';
- $output .= ' class="'.$data['input_class'].'">';
- $output .= '