X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=mw%2Fenv%2Fmodules%2Fmw_env_data.php;h=f0ddebabdd626e7666cf1609c124a5282416c7e4;hb=refs%2Fheads%2Fmaster;hp=3cb19d1fb0ff6c89fc99e5fac172ecc4d7072596;hpb=8da84cf3aa4d10d91f19b6df06ce4c5e9fcb79da;p=mtweb diff --git a/mw/env/modules/mw_env_data.php b/mw/env/modules/mw_env_data.php index 3cb19d1..f0ddeba 100644 --- a/mw/env/modules/mw_env_data.php +++ b/mw/env/modules/mw_env_data.php @@ -12,6 +12,27 @@ return isset($this->data) ? $this->data : false; } + public function load_data(){ + if(($plugins = $this->plugins("DESC")) === false){ + $this->erreur("Impossible de lire les plugins pour charger les modules de donnees", true); + } + $data = new mw_data(true); + foreach($plugins as $plugin_name => $plugin){ + if($plugin["installed"] && $plugin["enabled"]){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."plugins/".$plugin_name."/app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + } + } + } + $data->load_modules($this->path("mw_dir")."app/", "data/modules/share/"); + if($this->bdd("sgbd")){ + $data->load_modules($this->path("mw_dir")."app/", "data/modules/".($this->bdd("sgbd") == "xml" ? "xml" : "sql")."/"); + } + $data->set_env($this); + $this->set_data($data); + } + } // ------------------------------------------------------------------------------------------- @@ -25,71 +46,3 @@ } } - - // ------------------------------------------------------------------------------------------- - // class mw_sgbd - // - - abstract class mw_sgbd{ - - public $env; - public $link; - public $host; - public $base; - public $user; - public $password; - public $EXTENTION_OK; - - public function __construct($env, $params = array()){ - $this->env = $env; - $default_params = $this->default_params(); - $params = $this->prepare_params($params); - $this->host = isset($params["host"]) ? $params["host"] : $default_params["host"]; - $this->base = isset($params["base"]) ? $params["base"] : $default_params["base"]; - $this->user = isset($params["user"]) ? $params["user"] : $default_params["user"]; - $this->password = isset($params["password"]) ? $params["password"] : $default_params["password"]; - $this->EXTENTION_OK = $this->validate_extention(); - } - - public function name(){ - return ""; - } - - public function default_params(){ - return array( - "host" => "", - "base" => "", - "user" => "", - "password" => "" - ); - } - - public function prepare_params($params){ - return $params; - } - - public function validate_extention(){ - return false; - } - - public function authentication_required(){ - return false; - } - - public function get_link(){ - return $this->link; - } - - public function extention_ok(){ - return $this->EXTENTION_OK; - } - - public function replace_prefixes($content){ - return ( - ($prefix_codes = array_keys($this->env->bdd("table_prefix"))) ? - str_replace($prefix_codes, array_values($this->env->bdd("table_prefix")), $content) - : $content - ); - } - - }