3 class sml_data_install extends mw_data{
5 // ---------------------------------------------------------------------------------
9 function mw_sourceml_install_xml($plugin, $env){
10 $sgbd = $this->sgbd();
13 $res = $sgbd->data_exists("sml_authors"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
14 $res = $sgbd->data_exists("sml_classes"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
15 $res = $sgbd->data_exists("sml_licences"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
16 $res = $sgbd->data_exists("sml_sources"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
17 $res = $sgbd->data_exists("sml_sources_access"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
18 $res = $sgbd->data_exists("sml_sources_authors"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
19 $res = $sgbd->data_exists("sml_source_cache"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
20 $res = $sgbd->data_exists("sml_source_compositions"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
21 $res = $sgbd->data_exists("sml_source_derivations"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
22 $res = $sgbd->data_exists("sml_sources_invitations"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
24 if($RES === -1) return "impossible de savoir si les tables existent deja. installation annulee";
25 if($RES === 1) return "des tables existent deja en base. installation annulee";
27 if(!($version = $env->version("mw_sourceml"))){
28 return "impossible de lire la version de sourceml";
31 if(!$sgbd->create_data("sml_authors")) return "impossible de creer la table sml_authors";
32 if(!$sgbd->create_data("sml_classes")) return "impossible de creer la table sml_classes";
33 if(!$sgbd->create_data("sml_licences")) return "impossible de creer la table sml_licences";
34 if(!$sgbd->create_data("sml_sources")) return "impossible de creer la table sml_sources";
35 if(!$sgbd->create_data("sml_sources_access")) return "impossible de creer la table sml_sources_access";
36 if(!$sgbd->create_data("sml_sources_authors")) return "impossible de creer la table sml_sources_authors";
37 if(!$sgbd->create_data("sml_source_cache")) return "impossible de creer la table sml_source_cache";
38 if(!$sgbd->create_data("sml_source_compositions")) return "impossible de creer la table sml_source_compositions";
39 if(!$sgbd->create_data("sml_source_derivations")) return "impossible de creer la table sml_source_derivations";
40 if(!$sgbd->create_data("sml_sources_invitations")) return "impossible de creer la table sml_sources_invitations";
44 // ------------------------------------ sml_licences
50 "nom" => "Creative commons by-sa 2.0",
51 "url" => "http://creativecommons.org/licenses/by-sa/2.0/deed.fr"
59 "nom" => "Creative Commons by-nc-nd 2.5",
60 "url" => "http://creativecommons.org/licenses/by-nc-nd/2.5/"
68 "nom" => "Creative Commons by-nc-sa 2.5",
69 "url" => "http://creativecommons.org/licenses/by-nc-sa/2.5/"
77 "nom" => "Creative Commons by-nc 2.5",
78 "url" => "http://creativecommons.org/licenses/by-nc/2.5/"
86 "nom" => "Creative Commons by-nd 2.5",
87 "url" => "http://creativecommons.org/licenses/by-nd/2.5/"
95 "nom" => "Creative Commons by-sa 2.5",
96 "url" => "http://creativecommons.org/licenses/by-sa/2.5/"
104 "nom" => "Creative Commons by 2.5",
105 "url" => "http://creativecommons.org/licenses/by/2.5/"
113 "nom" => "Licence Art Libre",
114 "url" => "http://artlibre.org/licence/lal/"
122 "nom" => "Licence C Reaction",
123 "url" => "http://morne.free.fr/Necktar7/creactionfr.htm"
131 "nom" => "Yellow OpenMusic License",
132 "url" => "http://openmusic.linuxtag.org/yellow.html"
140 "nom" => "Green OpenMusic License",
141 "url" => "http://openmusic.linuxtag.org/green.html"
146 // ------------------------------------ sml_classes
173 // ------------------------------------ sml_sources_access
177 "sml_sources_access",
180 "intitule" => "administrateur"
186 "sml_sources_access",
189 "intitule" => "éditeur"
195 "sml_sources_access",
197 "nom" => "contributeur",
198 "intitule" => "contributeur"
203 // ------------------------------------ versions
209 "application" => "mw_sourceml",
210 "version" => $version
216 return "les tables ont ete ajoutees en base mais impossible d'y enregistrer les valeurs par defaut.";
222 // ---------------------------------------------------------------------------------
226 function mw_sourceml_uninstall_xml($plugin, $env){
227 $sgbd = $this->sgbd();
228 if(!$plugin->disable($env)) return "impossible de desactiver le plugin";
232 if(!$ERROR) if(!$sgbd->remove_data("sml_authors")) $ERROR = true;
233 if(!$ERROR) if(!$sgbd->remove_data("sml_classes")) $ERROR = true;
234 if(!$ERROR) if(!$sgbd->remove_data("sml_licences")) $ERROR = true;
235 if(!$ERROR) if(!$sgbd->remove_data("sml_sources")) $ERROR = true;
236 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_access")) $ERROR = true;
237 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_authors")) $ERROR = true;
238 if(!$ERROR) if(!$sgbd->remove_data("sml_source_cache")) $ERROR = true;
239 if(!$ERROR) if(!$sgbd->remove_data("sml_source_compositions")) $ERROR = true;
240 if(!$ERROR) if(!$sgbd->remove_data("sml_source_derivations")) $ERROR = true;
241 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_invitations")) $ERROR = true;
246 "table_name" => "versions",
247 "index_name" => "application",
248 "index_value" => "mw_sourceml"
254 return "erreur lors de la suppression des tables";