X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fapp%2Fdata%2Fmodules%2Fxml%2Fmw_data_xml_install.php;h=216d2a9e31d72a71c0d59359521a500c7c9169f0;hb=HEAD;hp=9bebcf969c5e90c855e3d4149ff69d6bf76fdc1c;hpb=0ada6496e6c552c473a5816734b38896ccdd345b;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..216d2a9 100644 --- a/mw/app/data/modules/xml/mw_data_xml_install.php +++ b/mw/app/data/modules/xml/mw_data_xml_install.php @@ -2,7 +2,7 @@ class mw_data_xml_install extends mw_data{ - function install_xml($params){ + public function install_xml($params){ $env = $this->env(); $data = $env->data(); $sgbd = $data->sgbd(); @@ -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."; } @@ -255,5 +274,3 @@ } } - -?> \ No newline at end of file