From 8bc0397daaff51b3810ce9860686147f2bcd57d4 Mon Sep 17 00:00:00 2001 From: dj3c1t Date: Fri, 20 Dec 2013 17:32:10 +0100 Subject: [PATCH] maj site_name si seul plugin --- mw_sourceml.php | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/mw_sourceml.php b/mw_sourceml.php index 301f9ca..740a25a 100644 --- a/mw_sourceml.php +++ b/mw_sourceml.php @@ -47,55 +47,78 @@ } function enable($env){ + $data = $env->data(); + if( + ($data->config("site_name") == "mtweb") + && (($plugins = $env->plugins()) !== false) + && (count($plugins) == 1) + ){ + $data->set_config("site_name", "SourceML"); + } return true; } function disable($env){ + $data = $env->data(); + if( + ($data->config("site_name") == "SourceML") + && (($plugins = $env->plugins()) !== false) + && (count($plugins) == 1) + ){ + $data->set_config("site_name", "mtweb"); + } return true; } function install($env){ $data = $env->data(); - + $res = true; if( $env->bdd("sgbd") == "mysql" || $env->bdd("sgbd") == "pdo_mysql" ){ $data->load_modules($env->path("mw_dir")."plugins/mw_sourceml/app/", "data/modules/sql/"); - return $data->mw_sourceml_install_mysql($this, $env); + $res = $data->mw_sourceml_install_mysql($this, $env); } elseif( $env->bdd("sgbd") == "pdo_sqlite" ){ $data->load_modules($env->path("mw_dir")."plugins/mw_sourceml/app/", "data/modules/sql/"); - return $data->mw_sourceml_install_sqlite($this, $env); + $res = $data->mw_sourceml_install_sqlite($this, $env); } elseif( $env->bdd("sgbd") == "xml" ){ $data->load_modules($env->path("mw_dir")."plugins/mw_sourceml/app/", "data/modules/xml/"); - return $data->mw_sourceml_install_xml($this, $env); + $res = $data->mw_sourceml_install_xml($this, $env); + } + else{ + $res = "Mode de stockage pour Mtweb (".$env->bdd("sgbd").") non supporté par SourceML"; } - return "Mode de stockage pour Mtweb (".$env->bdd("sgbd").") non supporté par SourceML"; + return $res; } function uninstall($env){ $data = $env->data(); + $res = true; if( $env->bdd("sgbd") == "mysql" || $env->bdd("sgbd") == "pdo_mysql" || $env->bdd("sgbd") == "pdo_sqlite" ){ $data->load_modules($env->path("mw_dir")."plugins/mw_sourceml/app/", "data/modules/sql/"); - return $data->mw_sourceml_uninstall_sql($this, $env); + $res = $data->mw_sourceml_uninstall_sql($this, $env); } - if( + elseif( $env->bdd("sgbd") == "xml" ){ $data->load_modules($env->path("mw_dir")."plugins/mw_sourceml/app/", "data/modules/xml/"); - return $data->mw_sourceml_uninstall_xml($this, $env); + $res = $data->mw_sourceml_uninstall_xml($this, $env); + } + else{ + $res = "Mode de stockage pour Mtweb (".$env->bdd("sgbd").") non supporté par SourceML"; } - return "Mode de stockage pour Mtweb (".$env->bdd("sgbd").") non supporté par SourceML"; + return $res; } } -- 2.1.4