auto activation (dans loaded) si donnees sml app sourceml.1.1.5
authordj3c1t <dj3c1t@free.fr>
Tue, 24 Dec 2013 14:06:46 +0000 (15:06 +0100)
committerdj3c1t <dj3c1t@free.fr>
Tue, 24 Dec 2013 14:06:46 +0000 (15:06 +0100)
app/config.xml
mw_sourceml.php

index d0fe939..0d914fd 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <config>
 
-  <version>1.1.4</version>
+  <version>1.1.5</version>
 
   <params>
     <parent>parent</parent>
index 740a25a..286c455 100644 (file)
       return "Publication de sources musicales";
     }
 
+    function loaded($env){
+      $AUTO_ACTIVATE = false;
+      if(!$env->bdd("sgbd") || ($plugin_data = $env->plugin_data("mw_sourceml")) === false) return;
+      if(!isset($plugin_data["installed"]) || !$plugin_data["installed"]){
+        $data = $env->data();
+        $sgbd = $data->sgbd();
+        if($env->bdd("sgbd") == "xml"){
+          $AUTO_ACTIVATE = $sgbd->data_exists("sources");
+        }
+        else{
+          $AUTO_ACTIVATE = $sgbd->table_exists("#--sources");
+        }
+      }
+      if($AUTO_ACTIVATE){
+        if(
+          $env->set_plugin_data(
+            "mw_sourceml",
+            array(
+              "installed" => true,
+              "enabled" => true,
+              "priorite" => 0
+            )
+          )
+        ){
+          $env->init_plugins("ASC", $RELOAD = true);
+        }
+      }
+    }
+
     function init($env){
 
       $env->set_link("admin/sourceml", $env->url("admin/sourceml"), "SourceML", 50);