installation automatique des plugins mtweb.0.12.0
authordj3c1t <dj3c1t@free.fr>
Thu, 19 Dec 2013 14:33:47 +0000 (15:33 +0100)
committerdj3c1t <dj3c1t@free.fr>
Thu, 19 Dec 2013 14:33:47 +0000 (15:33 +0100)
mw/app/controllers/install/index.php
mw/env/modules/mw_env_plugins.php

index c47b231..94e146b 100644 (file)
             $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é"
index 6e3e6fb..fefbd04 100644 (file)
@@ -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);
         }