From: dj3c1t Date: Tue, 24 Dec 2013 14:06:46 +0000 (+0100) Subject: auto activation (dans loaded) si donnees sml app X-Git-Tag: sourceml.1.1.5 X-Git-Url: http://git.dj3c1t.com/?p=mw_sourceml;a=commitdiff_plain;h=52f846308de21585448da22f0206eb295d70e482 auto activation (dans loaded) si donnees sml app --- diff --git a/app/config.xml b/app/config.xml index d0fe939..0d914fd 100644 --- a/app/config.xml +++ b/app/config.xml @@ -1,7 +1,7 @@ - 1.1.4 + 1.1.5 parent diff --git a/mw_sourceml.php b/mw_sourceml.php index 740a25a..286c455 100644 --- a/mw_sourceml.php +++ b/mw_sourceml.php @@ -10,6 +10,35 @@ 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);