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_sources_infos"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
20 $res = $sgbd->data_exists("sml_source_cache"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
21 $res = $sgbd->data_exists("sml_source_compositions"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
22 $res = $sgbd->data_exists("sml_source_derivations"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
23 $res = $sgbd->data_exists("sml_source_documents"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
24 $res = $sgbd->data_exists("sml_sources_invitations"); if(isset($res)){ if($res) $RES = 1; } else $RES = -1;
26 if($RES === -1) return "impossible de savoir si les tables existent deja. installation annulee";
27 if($RES === 1) return "des tables existent deja en base. installation annulee";
29 if(!($version = $env->version("mw_sourceml"))){
30 return "impossible de lire la version de sourceml";
33 if(!$sgbd->create_data("sml_authors")) return "impossible de creer la table sml_authors";
34 if(!$sgbd->create_data("sml_classes")) return "impossible de creer la table sml_classes";
35 if(!$sgbd->create_data("sml_licences")) return "impossible de creer la table sml_licences";
36 if(!$sgbd->create_data("sml_sources")) return "impossible de creer la table sml_sources";
37 if(!$sgbd->create_data("sml_sources_access")) return "impossible de creer la table sml_sources_access";
38 if(!$sgbd->create_data("sml_sources_authors")) return "impossible de creer la table sml_sources_authors";
39 if(!$sgbd->create_data("sml_sources_infos")) return "impossible de creer la table sml_sources_infos";
40 if(!$sgbd->create_data("sml_source_cache")) return "impossible de creer la table sml_source_cache";
41 if(!$sgbd->create_data("sml_source_compositions")) return "impossible de creer la table sml_source_compositions";
42 if(!$sgbd->create_data("sml_source_derivations")) return "impossible de creer la table sml_source_derivations";
43 if(!$sgbd->create_data("sml_source_documents")) return "impossible de creer la table sml_source_documents";
44 if(!$sgbd->create_data("sml_sources_invitations")) return "impossible de creer la table sml_sources_invitations";
48 // ------------------------------------ sml_licences
54 "nom" => "Creative commons by-sa 2.0",
55 "url" => "http://creativecommons.org/licenses/by-sa/2.0/deed.fr"
63 "nom" => "Creative Commons by-nc-nd 2.5",
64 "url" => "http://creativecommons.org/licenses/by-nc-nd/2.5/"
72 "nom" => "Creative Commons by-nc-sa 2.5",
73 "url" => "http://creativecommons.org/licenses/by-nc-sa/2.5/"
81 "nom" => "Creative Commons by-nc 2.5",
82 "url" => "http://creativecommons.org/licenses/by-nc/2.5/"
90 "nom" => "Creative Commons by-nd 2.5",
91 "url" => "http://creativecommons.org/licenses/by-nd/2.5/"
99 "nom" => "Creative Commons by-sa 2.5",
100 "url" => "http://creativecommons.org/licenses/by-sa/2.5/"
108 "nom" => "Creative Commons by 2.5",
109 "url" => "http://creativecommons.org/licenses/by/2.5/"
117 "nom" => "Licence Art Libre",
118 "url" => "http://artlibre.org/licence/lal/"
126 "nom" => "Licence C Reaction",
127 "url" => "http://morne.free.fr/Necktar7/creactionfr.htm"
135 "nom" => "Yellow OpenMusic License",
136 "url" => "http://openmusic.linuxtag.org/yellow.html"
144 "nom" => "Green OpenMusic License",
145 "url" => "http://openmusic.linuxtag.org/green.html"
150 // ------------------------------------ sml_classes
177 // ------------------------------------ sml_sources_access
181 "sml_sources_access",
184 "intitule" => "administrateur"
190 "sml_sources_access",
193 "intitule" => "éditeur"
199 "sml_sources_access",
201 "nom" => "contributeur",
202 "intitule" => "contributeur"
207 // ------------------------------------ versions
213 "application" => "mw_sourceml",
214 "version" => $version
220 return "les tables ont ete ajoutees en base mais impossible d'y enregistrer les valeurs par defaut.";
226 // ---------------------------------------------------------------------------------
230 function mw_sourceml_uninstall_xml($plugin, $env){
231 $sgbd = $this->sgbd();
232 if(!$plugin->disable($env)) return "impossible de desactiver le plugin";
236 if(!$ERROR) if(!$sgbd->remove_data("sml_authors")) $ERROR = true;
237 if(!$ERROR) if(!$sgbd->remove_data("sml_classes")) $ERROR = true;
238 if(!$ERROR) if(!$sgbd->remove_data("sml_licences")) $ERROR = true;
239 if(!$ERROR) if(!$sgbd->remove_data("sml_sources")) $ERROR = true;
240 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_access")) $ERROR = true;
241 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_authors")) $ERROR = true;
242 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_infos")) $ERROR = true;
243 if(!$ERROR) if(!$sgbd->remove_data("sml_source_cache")) $ERROR = true;
244 if(!$ERROR) if(!$sgbd->remove_data("sml_source_compositions")) $ERROR = true;
245 if(!$ERROR) if(!$sgbd->remove_data("sml_source_derivations")) $ERROR = true;
246 if(!$ERROR) if(!$sgbd->remove_data("sml_source_documents")) $ERROR = true;
247 if(!$ERROR) if(!$sgbd->remove_data("sml_sources_invitations")) $ERROR = true;
252 "table_name" => "versions",
253 "index_name" => "application",
254 "index_value" => "mw_sourceml"
260 return "erreur lors de la suppression des tables";