verification de la version
[mtweb] / mw / mw_app.php
index d1f6148..990d7a7 100644 (file)
       if(!$this->init_pathes()) return $this->get_error();
       if(!$this->init_config()) return $this->get_error();
       if(!$this->init_env()) return $this->get_error();
-      if($this->config_file) return true;
-      if($this->DO_SETUP) $this->setup();
-      return $this->get_error();
+      if(!$this->config_file){
+        if($this->DO_SETUP){
+          $this->setup();
+          exit;
+        }
+        return $this->get_error();
+      }
+      $env = $this->env();
+      if(!$env->version("mtweb")){
+        $this->error("impossible de lire la version du code");
+        return $this->get_error();
+      }
+      $data = $env->data();
+      if($data->version("mtweb") != $env->version("mtweb")){
+        $this->upgrade();
+        exit;
+      }
+      return true;
     }
 
     function init_pathes(){
       $etat = isset($_GET[$env->param("e")]) ? $_GET[$env->param("e")] : "install";
       $env->run($etat, array(), false);
       $this->display();
-      exit;
+    }
+
+    function upgrade(){
+      debug("la base de données doit être mise à jour");
     }
 
     function error($content){