[PLUGINS] +set de base
[lhc/web/www.git] / www / plugins / notifications2 / notifications_administrations.php
1 <?php
2 /*
3 * Plugin Notifications
4 * (c) 2009-2012 SPIP
5 * Distribue sous licence GPL
6 *
7 */
8
9 if (!defined("_ECRIRE_INC_VERSION")) return;
10
11
12 /**
13 * Declarer le champ notification_email sur la table forum
14 *
15 * @param array $tables
16 * @return array
17 */
18 function notifications_declarer_tables_objets_sql($tables){
19
20 // champ notification (editable via le form de forum) :
21 // 0/1 (non abonne/abonne) defaut 1
22 $tables['spip_forum']['field']['notification'] = "tinyint NOT NULL default 1";
23 $tables['spip_forum']['champs_editables'][] = 'notification';
24
25 // champ notification_email :
26 // vide -> notification par le champ id_auteur ou email_auteur
27 // email -> notification sur cet email (permet de maj l'email de notif sans modifier l'email de signature)
28 $tables['spip_forum']['field']['notification_email'] = "text DEFAULT '' NOT NULL";
29
30 return $tables;
31 }
32
33
34 /**
35 * maj de table forum
36 *
37 * @param string $nom_meta_base_version
38 * @param string $version_cible
39 */
40 function notifications_upgrade($nom_meta_base_version,$version_cible){
41
42 $maj = array();
43 $maj['create'] = array(
44 array('maj_tables',array('spip_forum')),
45 );
46
47 $maj['0.1.3'] = array(
48 array('sql_alter',"TABLE spip_forum CHANGE notification notification_email text DEFAULT '' NOT NULL"),
49 array('maj_tables',array('spip_forum')),
50 );
51
52 include_spip('base/upgrade');
53 maj_plugin($nom_meta_base_version, $version_cible, $maj);
54 }
55
56 function notifications_vider_tables($nom_meta_base_version) {
57 #on ne drop pas pour ne pas perdre les reglages.. a voir
58 #sql_alter("TABLE spip_forum DROP COLUMN notification");
59 effacer_meta($nom_meta_base_version);
60 }