X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fmw_app.php;h=38d094d86f1c1f1e3c550b52734a740a03ec6f29;hb=af318ad7150a54780f3912d7fbf805c7382b2785;hp=5349b795ac2f4de8fd5d522c071080d2a57cd05e;hpb=441212b3fdf07852be95c4a59315aa39a7264249;p=mtweb diff --git a/mw/mw_app.php b/mw/mw_app.php index 5349b79..38d094d 100644 --- a/mw/mw_app.php +++ b/mw/mw_app.php @@ -46,18 +46,25 @@ return $this->get_error(); } $env = $this->env(); - if($env->data_upgrade_required()){ + if(($res = $env->data_upgrade_required()) === true){ $this->upgrade(); exit; } + else{ + if($res !== false){ + $this->error($res); + return $this->get_error(); + } + } return true; } function init_pathes(){ - if(($n = strpos($_SERVER["REQUEST_URI"], "?")) !== false){ - $_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], 0, $n); + $REQUEST_URI = $_SERVER["REQUEST_URI"]; + if(($n = strpos($REQUEST_URI, "?")) !== false){ + $REQUEST_URI = substr($REQUEST_URI, 0, $n); } - $web_path = explode("/", preg_replace('#/+#','/',$_SERVER["REQUEST_URI"])); + $web_path = explode("/", preg_replace('#/+#','/',$REQUEST_URI)); $this->pathes["web"] = ""; for($i = 0; $i < count($web_path) - 1; $i++) $this->pathes["web"] .= $web_path[$i]."/"; if( @@ -94,7 +101,11 @@ $this->error("dossier content introuvable"); return false; } - if(!is_writable($this->pathes["content"])){ + if( + !is_writable($this->pathes["content"]) + || !is_writable($this->pathes["content"]."config") + || !is_writable($this->pathes["content"]."data") + ){ $this->error("Php ne peut pas ecrire dans le dossier content"); return false; } @@ -160,7 +171,11 @@ $env->load_versions(); $env->load_config($this->bdd, $this->config); $env->init(); - $env->init_data_upgrades(); + $env->loaded_plugins(); + if(($res = $env->init_data_upgrades()) !== true){ + $this->error("impossible de lire les upgrades. ".$res); + return false; + } return true; } @@ -195,6 +210,9 @@ } function upgrade(){ + $env = $this->env(); + $data = $env->data(); + $data->load_session(); if($this->run_mod("upgrade", false)){ $this->display(); }