From: dj3c1t Date: Thu, 19 Dec 2013 14:33:47 +0000 (+0100) Subject: installation automatique des plugins X-Git-Tag: mtweb.0.12.0 X-Git-Url: http://git.dj3c1t.com/index.cgi?a=commitdiff_plain;h=abc64414fdac6533c011c28b53cba6d28dee4f2a;p=mtweb installation automatique des plugins --- diff --git a/mw/app/controllers/install/index.php b/mw/app/controllers/install/index.php index c47b231..94e146b 100644 --- a/mw/app/controllers/install/index.php +++ b/mw/app/controllers/install/index.php @@ -163,6 +163,51 @@ $env->erreur("impossible de créer le fichier de configuration"); return; } + require_once $this->config_file; + if( + isset($CONFIG) + && is_array($CONFIG) + ){ + $env->set_config($CONFIG); + } + if( + isset($bdd) + && is_array($bdd) + ){ + foreach($bdd as $bdd_key => $bdd_value){ + if($bdd_key == "table_prefix"){ + if(!($table_prefix = $env->bdd("table_prefix"))){ + $env->erreur("impossible de lire les prefixes de tables"); + return; + } + foreach($table_prefix as $prefix_code => $prefix_value) break; + if(!isset($prefix_code)){ + $env->erreur("impossible de lire le code pour le prefixe de tables"); + return; + } + $table_prefix[$prefix_code] = $bdd_value; + $env->add_table_prefix($table_prefix); + } + else{ + $env->set_bdd($bdd_key, $bdd_value); + } + } + } + if(($plugins = $env->plugins("DESC")) === false){ + $env->erreur("impossible de lister les plugins"); + } + foreach($plugins as $plugin_name => $plugin){ + if(!$plugin["installed"]){ + $env->run("config/plugins/install", array("get" => array("id" => $plugin_name)), false); + if($env->erreurs()) return; + $env->init_plugins("DESC", true); + } + if(!$plugin["enabled"]){ + $env->run("config/plugins/enable", array("get" => array("id" => $plugin_name)), false); + if($env->erreurs()) return; + $env->init_plugins("DESC", true); + } + } $env->redirect( $env->url(), "le site a été installé" diff --git a/mw/env/modules/mw_env_plugins.php b/mw/env/modules/mw_env_plugins.php index 6e3e6fb..fefbd04 100644 --- a/mw/env/modules/mw_env_plugins.php +++ b/mw/env/modules/mw_env_plugins.php @@ -16,8 +16,8 @@ # init # - function init_plugins($PRIORITE = "ASC"){ - if(isset($this->plugins_asc) || isset($this->plugins_desc)){ + function init_plugins($PRIORITE = "ASC", $RELOAD = false){ + if(!$RELOAD && (isset($this->plugins_asc) || isset($this->plugins_desc))){ if($PRIORITE == "ASC"){ if(!isset($this->plugins_asc)) $this->plugins_asc = $this->ordonne_plugins($this->plugins_desc, $PRIORITE); }