function creer_champs_extras($champs, $nom_meta_base_version, $version_cible) { $current_version = 0.0; if ((!isset($GLOBALS['meta'][$nom_meta_base_version])) || (($current_version = $GLOBALS['meta'][$nom_meta_base_version])!=$version_cible)){ // cas d'une installation if ($current_version==0.0){ include_spip('base/create'); // on recupere juste les differentes tables a mettre a jour $tables = array(); foreach ($champs as $c){ if ($table = table_objet_sql($c->table)) { $tables[$table] = $table; } } // on met a jour les tables trouvees foreach($tables as $table) { maj_tables($table); } ecrire_meta($nom_meta_base_version,$current_version=$version_cible,'non'); } } } function vider_champs_extras($champs, $nom_meta_base_version) { // on efface chaque champ trouve foreach ($champs as $c){ if ($table = table_objet_sql($c->table) and $c->champ and $c->sql) { sql_alter("TABLE $table DROP $c->champ"); } } effacer_meta($nom_meta_base_version); }