3 class sml_data_install extends mw_data{
5 // ---------------------------------------------------------------------------------
9 public function mw_sourceml_install_xml($plugin, $env){
10 $sgbd = $this->sgbd();
13 $res = $sgbd->data_exists("sml_authors");
18 $res = $sgbd->data_exists("sml_classes");
23 $res = $sgbd->data_exists("sml_licences");
28 $res = $sgbd->data_exists("sml_sources");
33 $res = $sgbd->data_exists("sml_sources_access");
38 $res = $sgbd->data_exists("sml_sources_authors");
43 $res = $sgbd->data_exists("sml_source_cache");
48 $res = $sgbd->data_exists("sml_source_compositions");
53 $res = $sgbd->data_exists("sml_source_derivations");
58 $res = $sgbd->data_exists("sml_sources_invitations");
64 if($RES === -1) return "impossible de savoir si les tables existent deja. installation annulee";
65 if($RES === 1) return "des tables existent deja en base. installation annulee";
67 if(!($version = $env->version("mw_sourceml"))){
68 return "impossible de lire la version de sourceml";
71 if(!$sgbd->create_data("sml_authors")) return "impossible de creer la table sml_authors";
72 if(!$sgbd->create_data("sml_classes")) return "impossible de creer la table sml_classes";
73 if(!$sgbd->create_data("sml_licences")) return "impossible de creer la table sml_licences";
74 if(!$sgbd->create_data("sml_sources")) return "impossible de creer la table sml_sources";
75 if(!$sgbd->create_data("sml_sources_access")) return "impossible de creer la table sml_sources_access";
76 if(!$sgbd->create_data("sml_sources_authors")) return "impossible de creer la table sml_sources_authors";
77 if(!$sgbd->create_data("sml_source_cache")) return "impossible de creer la table sml_source_cache";
78 if(!$sgbd->create_data("sml_source_compositions")) return "impossible de creer la table sml_source_compositions";
79 if(!$sgbd->create_data("sml_source_derivations")) return "impossible de creer la table sml_source_derivations";
80 if(!$sgbd->create_data("sml_sources_invitations")) return "impossible de creer la table sml_sources_invitations";
84 // ------------------------------------ sml_licences
90 "nom" => "Creative commons by-sa 2.0",
91 "url" => "http://creativecommons.org/licenses/by-sa/2.0/deed.fr"
99 "nom" => "Creative Commons by-nc-nd 2.5",
100 "url" => "http://creativecommons.org/licenses/by-nc-nd/2.5/"
108 "nom" => "Creative Commons by-nc-sa 2.5",
109 "url" => "http://creativecommons.org/licenses/by-nc-sa/2.5/"
117 "nom" => "Creative Commons by-nc 2.5",
118 "url" => "http://creativecommons.org/licenses/by-nc/2.5/"
126 "nom" => "Creative Commons by-nd 2.5",
127 "url" => "http://creativecommons.org/licenses/by-nd/2.5/"
135 "nom" => "Creative Commons by-sa 2.5",
136 "url" => "http://creativecommons.org/licenses/by-sa/2.5/"
144 "nom" => "Creative Commons by 2.5",
145 "url" => "http://creativecommons.org/licenses/by/2.5/"
153 "nom" => "Licence Art Libre",
154 "url" => "http://artlibre.org/licence/lal/"
162 "nom" => "Licence C Reaction",
163 "url" => "http://morne.free.fr/Necktar7/creactionfr.htm"
171 "nom" => "Yellow OpenMusic License",
172 "url" => "http://openmusic.linuxtag.org/yellow.html"
180 "nom" => "Green OpenMusic License",
181 "url" => "http://openmusic.linuxtag.org/green.html"
186 // ------------------------------------ sml_classes
213 // ------------------------------------ sml_sources_access
217 "sml_sources_access",
220 "intitule" => "administrateur"
226 "sml_sources_access",
229 "intitule" => "éditeur"
235 "sml_sources_access",
237 "nom" => "contributeur",
238 "intitule" => "contributeur"
243 // ------------------------------------ versions
249 "application" => "mw_sourceml",
250 "version" => $version
256 return "les tables ont ete ajoutees en base mais impossible d'y enregistrer les valeurs par defaut.";
262 // ---------------------------------------------------------------------------------
266 public function mw_sourceml_uninstall_xml($plugin, $env){
267 $sgbd = $this->sgbd();
268 if(!$plugin->disable($env)) return "impossible de desactiver le plugin";
272 if(!$ERROR) if(!$sgbd->remove_data("sml_authors")) $ERROR = true;
273 if(!$ERROR) if(!$sgbd->remove_data("sml_classes")) $ERROR = true;
274 if(!$ERROR) if(!$sgbd->remove_data("sml_licences")) $ERROR = true;
275 if(!$ERROR) if(!$sgbd->remove_data("sml_sources")) $ERROR = true;
276 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_access")) $ERROR = true;
277 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_authors")) $ERROR = true;
278 if(!$ERROR) if(!$sgbd->remove_data("sml_source_cache")) $ERROR = true;
279 if(!$ERROR) if(!$sgbd->remove_data("sml_source_compositions")) $ERROR = true;
280 if(!$ERROR) if(!$sgbd->remove_data("sml_source_derivations")) $ERROR = true;
281 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_invitations")) $ERROR = true;
286 "table_name" => "versions",
287 "index_name" => "application",
288 "index_value" => "mw_sourceml"
294 return "erreur lors de la suppression des tables";