mecanisme d'upgrade
[mtweb] / mw / env / modules / mw_env_config.php
index a708431..5f14e35 100644 (file)
@@ -51,7 +51,7 @@
       if(isset($app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"])){
         $this->add_table_prefix(
           array(
-            $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => $bdd["table_prefix"]
+            $app_config["subs"]["bdd"][0]["subs"]["table_prefix_code"][0]["data"] => isset($bdd["table_prefix"]) ? $bdd["table_prefix"] : ""
           )
         );
       }
       $this->bdd[$key] = $value;
     }
 
+    function bdd_ready(){
+      if(!$this->bdd("sgbd")) return "aucun sgbd defini";
+      $data = $this->data();
+      if(!$data) return "objet data non defini";
+      if(!$this->version("mtweb")) return "impossible de lire la version de mtweb";
+      if($data->version("mtweb") != $this->version("mtweb")) return "la version de la base et du code sont diffĂ©rentes";
+      return true;
+    }
+
     function add_table_prefix($table_prefix){
       if(is_array($table_prefix)){
         foreach($table_prefix as $prefix_code => $prefix) $this->bdd["table_prefix"][$prefix_code] = $prefix;