From 2bd6623e097a52235bf446d24b09b02e3a5780e8 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 7 Mar 2013 17:20:41 +0000 Subject: [PATCH] 2013-03-07 Miguel de Dios * pandoradb.oracle.sql, extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, godmode/agentes/planned_downtime.editor.php, pandoradb.sql, pandoradb.postgreSQL.sql: added id_user to planned_downtime table for to know who create or updte any downtime. Fixes: #3607172 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7810 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 ++++++++++++ .../extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 1 + .../extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 1 + .../pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 1 + .../godmode/agentes/planned_downtime.editor.php | 12 ++++++++++-- pandora_console/pandoradb.oracle.sql | 3 ++- pandora_console/pandoradb.postgreSQL.sql | 3 ++- pandora_console/pandoradb.sql | 1 + 8 files changed, 30 insertions(+), 4 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 844c5f771d..d33dcb829e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-03-07 Miguel de Dios + + * pandoradb.oracle.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, + godmode/agentes/planned_downtime.editor.php, pandoradb.sql, + pandoradb.postgreSQL.sql: added id_user to planned_downtime table + for to know who create or updte any downtime. + + Fixes: #3607172 + 2013-03-07 Sergio Martin * include/functions_events.php diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index 4d071365af..4672c8b6a8 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -100,6 +100,7 @@ ALTER TABLE `tplanned_downtime` ADD COLUMN `periodically_day_to` int(100) unsign ALTER TABLE `tplanned_downtime` ADD COLUMN `type_downtime` varchar(100) NOT NULL default 'disabled_agents_alerts'; ALTER TABLE `tplanned_downtime` ADD COLUMN `type_execution` varchar(100) NOT NULL default 'once'; ALTER TABLE `tplanned_downtime` ADD COLUMN `type_periodicity` varchar(100) NOT NULL default 'weekly'; +ALTER TABLE `tplanned_downtime` ADD COLUMN `id_user` varchar(100) NOT NULL default '0'; -- ---------------------------------------------------------------------- -- Table `tplanned_downtime_agents` diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index 1082fe494c..1f44a496e3 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -125,6 +125,7 @@ ALTER TABLE tplanned_downtime ADD (periodically_day_to NUMBER(19, 0) default NUL ALTER TABLE tplanned_downtime ADD (type_downtime VARCHAR2(100) NOT NULL default 'disabled_agents_alerts'); ALTER TABLE tplanned_downtime ADD (type_execution VARCHAR2(100) NOT NULL default 'once'); ALTER TABLE tplanned_downtime ADD (type_periodicity VARCHAR2(100) NOT NULL default 'weekly'); +ALTER TABLE tplanned_downtime ADD (id_user VARCHAR2(100) default '0' NOT NULL); -- ----------------------------------------------------- -- Table tplanned_downtime_agents diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index b2c3468f5d..a68925f650 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -118,6 +118,7 @@ ALTER TABLE "tplanned_downtime" ADD COLUMN "periodically_day_to" SMALLINT defaul ALTER TABLE "tplanned_downtime" ADD COLUMN "type_downtime" VARCHAR( 100 ) NOT NULL default 'disabled_agents_alerts'; ALTER TABLE "tplanned_downtime" ADD COLUMN "type_execution" VARCHAR( 100 ) NOT NULL default 'once'; ALTER TABLE "tplanned_downtime" ADD COLUMN "type_periodicity" VARCHAR( 100 ) NOT NULL default 'weekly'; +ALTER TABLE "tplanned_downtime" ADD COLUMN "id_user" varchar(100) NOT NULL default '0'; -- ----------------------------------------------------- -- Table "tplanned_downtime_agents" diff --git a/pandora_console/godmode/agentes/planned_downtime.editor.php b/pandora_console/godmode/agentes/planned_downtime.editor.php index 68783ab572..2210e768d5 100755 --- a/pandora_console/godmode/agentes/planned_downtime.editor.php +++ b/pandora_console/godmode/agentes/planned_downtime.editor.php @@ -115,6 +115,12 @@ if ($insert_downtime_agent == 1) { 'id_agent' => $id_agente_dt, 'id_agent_module' => $module["id_agente_modulo"]); $result = db_process_sql_insert('tplanned_downtime_modules', $values); + + if ($result) { + $values = array('id_user' => $config['id_user']); + $result = db_process_sql_update('tplanned_downtime', + $values, array('id' => $id_downtime)); + } } } } @@ -177,7 +183,8 @@ if ($create_downtime || $update_downtime) { 'periodically_day_to' => $periodically_day_to, 'type_downtime' => $type_downtime, 'type_execution' => $type_execution, - 'type_periodicity' => $type_periodicity + 'type_periodicity' => $type_periodicity, + 'id_user' => $config['id_user'] ); $result = db_process_sql_insert( 'tplanned_downtime', $values); @@ -215,7 +222,8 @@ if ($create_downtime || $update_downtime) { 'periodically_day_to' => $periodically_day_to, 'type_downtime' => $type_downtime, 'type_execution' => $type_execution, - 'type_periodicity' => $type_periodicity + 'type_periodicity' => $type_periodicity, + 'id_user' => $config['id_user'] ); $result = db_process_sql_update('tplanned_downtime', $values, array('id' => $id_downtime)); } diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 884e4cc9a5..d1ce9b3075 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1255,7 +1255,8 @@ CREATE TABLE tplanned_downtime ( periodically_day_to NUMBER(19, 0) default NULL, type_downtime VARCHAR2(100) NOT NULL default 'disabled_agents_alerts', type_execution VARCHAR2(100) NOT NULL default 'once', - type_periodicity VARCHAR2(100) NOT NULL default 'weekly' + type_periodicity VARCHAR2(100) NOT NULL default 'weekly', + id_user VARCHAR2(100) default '0' NOT NULL ); CREATE SEQUENCE tplanned_downtime_s INCREMENT BY 1 START WITH 1; CREATE OR REPLACE TRIGGER tplanned_downtime_inc BEFORE INSERT ON tplanned_downtime REFERENCING NEW AS NEW FOR EACH ROW BEGIN SELECT tplanned_downtime_s.nextval INTO :NEW.ID FROM dual; END tplanned_downtime_inc;; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 002eaa659c..d9725d7223 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1104,7 +1104,8 @@ CREATE TABLE "tplanned_downtime" ( "periodically_day_to" SMALLINT default NULL, "type_downtime" VARCHAR( 100 ) NOT NULL default 'disabled_agents_alerts', "type_execution" VARCHAR( 100 ) NOT NULL default 'once', - "type_periodicity" VARCHAR( 100 ) NOT NULL default 'weekly' + "type_periodicity" VARCHAR( 100 ) NOT NULL default 'weekly', + "id_user" varchar(100) NOT NULL default '0' ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 7d1e62a6c3..beb9b869c3 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1195,6 +1195,7 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime` ( `type_downtime` varchar(100) NOT NULL default 'disabled_agents_alerts', `type_execution` varchar(100) NOT NULL default 'once', `type_periodicity` varchar(100) NOT NULL default 'weekly', + `id_user` varchar(100) NOT NULL default '0', PRIMARY KEY ( `id` ) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;