X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fmodules%2Fxml%2Fmw_data_xml_install.php;fp=mw%2Fapp%2Fdata%2Fmodules%2Fxml%2Fmw_data_xml_install.php;h=61bfe96fdbfe4260c1f440ee6bcd46567a659cca;hb=bec31526c19092982057acabfe12e121442ec19b;hp=9bebcf969c5e90c855e3d4149ff69d6bf76fdc1c;hpb=622eff0b10a740f80efe9f35b58373a9eab54dfe;p=mtweb diff --git a/mw/app/data/modules/xml/mw_data_xml_install.php b/mw/app/data/modules/xml/mw_data_xml_install.php index 9bebcf9..61bfe96 100644 --- a/mw/app/data/modules/xml/mw_data_xml_install.php +++ b/mw/app/data/modules/xml/mw_data_xml_install.php @@ -32,6 +32,9 @@ ){ return "impossible de se connecter à la base XML"; } + if(!($version = $env->version("mtweb"))){ + return "impossible de lire la version de mtweb"; + } $ERROR = false; $EXISTS = false; if(!$ERROR && !$EXISTS) $EXISTS = $sgbd->data_exists("actions_roles"); @@ -44,6 +47,8 @@ $ERROR = !isset($EXISTS); if(!$ERROR && !$EXISTS) $EXISTS = $sgbd->data_exists("users_roles"); $ERROR = !isset($EXISTS); + if(!$ERROR && !$EXISTS) $EXISTS = $sgbd->data_exists("versions"); + $ERROR = !isset($EXISTS); if($ERROR){ return "impossible de savoir si les tables existent deja"; } @@ -55,6 +60,7 @@ if(!$ERROR) if(!$sgbd->create_data("roles")) $ERROR = true; if(!$ERROR) if(!$sgbd->create_data("users")) $ERROR = true; if(!$ERROR) if(!$sgbd->create_data("users_roles")) $ERROR = true; + if(!$ERROR) if(!$sgbd->create_data("versions")) $ERROR = true; if($ERROR){ return "imposible de creer les tables en base"; } @@ -247,6 +253,19 @@ ) ) $ERROR = true; + // ------------------------------------ versions + if(!$ERROR){ + $res = $sgbd->add_data( + "versions", + array( + "application" => "mtweb", + "version" => $version + ), + 0 + ); + if(!isset($res)) $ERROR = true; + } + if($ERROR){ return "les tables ont ete ajoutees en base mais impossible d'y enregistrer les valeurs par defaut."; }