diff --git a/include/config.php b/include/config.php index 99bc3bd866d069f49dd648a261b68c0442589e15..b1ac437b752cb672279b698f63b40e652b94cbb5 100644 --- a/include/config.php +++ b/include/config.php @@ -23,7 +23,7 @@ // ####################################### // # General Information // ####################################### -$version="5.2"; +$version="5.2.1"; // ####################################### // # Database config information diff --git a/include/function.php b/include/function.php index 895977cfe1878b669b1a3fd852025c0d8febd779..e28c9b0914e4146644d78a7a80e54e0c33f4257a 100644 --- a/include/function.php +++ b/include/function.php @@ -1312,4 +1312,37 @@ function getEonConfig($name,$type=false) } +function checkUpdateDB(){ + global $version; + global $database_eonweb; + global $database_username; + global $database_password; + + $version_sql = sqlrequest($database_eonweb,"SELECT count(value) as value FROM configs WHERE name='version'"); + if(mysqli_result($version_sql,0,"value") == 0){ + $version_sql = sqlrequest($database_eonweb,"INSERT INTO configs (name, value) VALUES('version', '".$version."')"); + + // execution de tous les .sql jusqu'à la version donné dans config + exec("ls /srv/eyesofnetwork/eonweb/appliance/updates/ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n", $SQL_Files); + + foreach($SQL_Files as $file){ + echo "mysql -u $database_username --password=$database_password < /srv/eyesofnetwork/eonweb/appliance/updates/$file"; + exec("mysql -u $database_username --password=$database_password < /srv/eyesofnetwork/eonweb/appliance/updates/$file"); + } + + }else{ + $versionBD = mysqli_result(sqlrequest($database_eonweb,"SELECT value FROM configs WHERE name='version'"),0,"value"); + + // execution des .sql entre version en BD et celle config + exec("ls /srv/eyesofnetwork/eonweb/appliance/updates/ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n", $SQL_Files); + foreach($SQL_Files as $file){ + if((rtrim($file,'.sql') <= $version && rtrim($file,'.sql') > $versionBD)){ + echo "mysql -u $database_username --password=$database_password < /srv/eyesofnetwork/eonweb/appliance/updates/$file"; + exec("mysql -u $database_username --password=$database_password < /srv/eyesofnetwork/eonweb/appliance/updates/$file"); + } + } + sqlrequest($database_eonweb,"UPDATE configs SET value='$version' WHERE name='version'"); + } +} + ?> diff --git a/index.php b/index.php index 9d08941ff795efc89bccac46c2bb43c011c35ae1..8ca0fa0547462ce4824374f7b5c2b76da6b13d10 100644 --- a/index.php +++ b/index.php @@ -23,6 +23,7 @@ include("include/config.php"); include("include/function.php"); $defaultpage=getDefaultPage(); +checkUpdateDB(); header("Location: $defaultpage"); ?> diff --git a/login.php b/login.php index 06181420995a46a9a9cebf7196fae89869478ce8..eea5233ec097144178d315706fd934047bfc40c0 100644 --- a/login.php +++ b/login.php @@ -255,5 +255,4 @@ else { } else { display_login(); } } - ?> diff --git a/module/admin_notifier/db/notifier.sql b/module/admin_notifier/db/notifier.sql index 6545282db0f962ecb7b2074942a23e97685f6c3e..fe8929024cde0cb738ea77a0260b70cfcfd424b6 100644 --- a/module/admin_notifier/db/notifier.sql +++ b/module/admin_notifier/db/notifier.sql @@ -128,6 +128,7 @@ CREATE TABLE `rules` ( `notificationnumber` varchar(255) NOT NULL DEFAULT '*', `timeperiod_id` bigint unsigned NOT NULL, `sort_key` int(32) NOT NULL default 0, + `tracking` INT(11) NULL DEFAULT '0', PRIMARY KEY (`id`), KEY `timeperiod_id` (`timeperiod_id`), CONSTRAINT `rules_ibfk_1` FOREIGN KEY (`timeperiod_id`) REFERENCES `timeperiods` (`id`)