1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | function plugin_install() |
---|
5 | { |
---|
6 | global $conf, $prefixeTable; |
---|
7 | |
---|
8 | $query = ' |
---|
9 | CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collections` ( |
---|
10 | `id` mediumint(8) NOT NULL AUTO_INCREMENT, |
---|
11 | `user_id` smallint(5) DEFAULT NULL, |
---|
12 | `name` varchar(255) NOT NULL, |
---|
13 | `date_creation` datetime NOT NULL, |
---|
14 | `nb_images` mediumint(8) NOT NULL DEFAULT 0, |
---|
15 | `active` tinyint(1) DEFAULT 0, |
---|
16 | `public` tinyint(1) DEFAULT 0, |
---|
17 | PRIMARY KEY (`id`) |
---|
18 | ) DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 |
---|
19 | ;'; |
---|
20 | pwg_query($query); |
---|
21 | |
---|
22 | $query = ' |
---|
23 | CREATE TABLE IF NOT EXISTS `'.$prefixeTable.'collection_images` ( |
---|
24 | `col_id` mediumint(8) NOT NULL, |
---|
25 | `image_id` mediumint(8) NOT NULL, |
---|
26 | UNIQUE KEY `UNIQUE` (`col_id`,`image_id`) |
---|
27 | ) DEFAULT CHARSET=utf8 |
---|
28 | ;'; |
---|
29 | pwg_query($query); |
---|
30 | } |
---|
31 | |
---|
32 | function plugin_activate() |
---|
33 | {} |
---|
34 | |
---|
35 | function plugin_uninstall() |
---|
36 | { |
---|
37 | global $prefixeTable; |
---|
38 | |
---|
39 | pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "user_collections" LIMIT 1;'); |
---|
40 | pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collections`;'); |
---|
41 | pwg_query('DROP TABLE IF EXISTS `'.$prefixeTable.'collection_images`;'); |
---|
42 | } |
---|
43 | |
---|
44 | ?> |
---|