Commit 1292217a authored by Bastien Pujos's avatar Bastien Pujos

All the update

parent 62ec48f6
......@@ -23,7 +23,7 @@
// #######################################
// # General Information
// #######################################
$version="5.2";
$version="5.2.1";
// #######################################
// # Database config information
......
......@@ -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'");
}
}
?>
......@@ -23,6 +23,7 @@
include("include/config.php");
include("include/function.php");
$defaultpage=getDefaultPage();
checkUpdateDB();
header("Location: $defaultpage");
?>
......@@ -255,5 +255,4 @@ else {
}
else { display_login(); }
}
?>
......@@ -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`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment