1 | <?php |
---|
2 | function plugin_install($id, $version, &$errors) |
---|
3 | { |
---|
4 | if (version_compare(PHP_VERSION, '5.3') < 0) |
---|
5 | { |
---|
6 | $errors[] = "PHP 5.3 required"; |
---|
7 | return; |
---|
8 | } |
---|
9 | global $prefixeTable; |
---|
10 | |
---|
11 | $q = ' |
---|
12 | CREATE TABLE `'.$prefixeTable.'suggestions` ( |
---|
13 | `id` INT NOT NULL AUTO_INCREMENT, |
---|
14 | `name` VARCHAR(255) NOT NULL, |
---|
15 | `counter` INT NOT NULL DEFAULT 0, |
---|
16 | `url` VARCHAR(255) DEFAULT NULL, |
---|
17 | `level` tinyint unsigned NOT NULL default 0, |
---|
18 | PRIMARY KEY (`id`) , |
---|
19 | UNIQUE INDEX `i_name` (`name` ASC) )'; |
---|
20 | |
---|
21 | pwg_query( create_table_add_character_set($q) ); |
---|
22 | |
---|
23 | $opts = array( 'excluded_tags'=>array(), 'excluded_albums'=>array() ); |
---|
24 | conf_update_param('rvac_opts', addslashes(serialize($opts)) ); |
---|
25 | } |
---|
26 | |
---|
27 | function plugin_activate($id, $version, &$errors) |
---|
28 | { |
---|
29 | global $conf; |
---|
30 | conf_update_param('rvac_version', @++$conf['rvac_version'] ); |
---|
31 | } |
---|
32 | |
---|
33 | function plugin_uninstall() |
---|
34 | { |
---|
35 | global $prefixeTable; |
---|
36 | $q = 'DROP TABLE IF EXISTS '.$prefixeTable.'suggestions'; |
---|
37 | pwg_query($q); |
---|
38 | |
---|
39 | $q = 'DELETE FROM '.CONFIG_TABLE.' |
---|
40 | WHERE param IN(\'rvac_opts\',\'rvac_version\')'; |
---|
41 | pwg_query($q); |
---|
42 | } |
---|
43 | |
---|
44 | ?> |
---|