1 | <?php |
---|
2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
3 | |
---|
4 | class MyPiwiShop_maintain extends PluginMaintain |
---|
5 | { |
---|
6 | private $installed = false; |
---|
7 | |
---|
8 | |
---|
9 | function install($plugin_version, &$errors=array()) |
---|
10 | { |
---|
11 | global $prefixeTable; |
---|
12 | |
---|
13 | pwg_query(' |
---|
14 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_conf` ( |
---|
15 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, |
---|
16 | `PPid` varchar(100) NOT NULL, |
---|
17 | `currency` varchar(100), |
---|
18 | `ship` decimal NOT NULL, |
---|
19 | `comm` text , |
---|
20 | `tprmulti` varchar(200) , |
---|
21 | `tpruniq` varchar(200) , |
---|
22 | PRIMARY KEY (`id`) |
---|
23 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
24 | ;'); |
---|
25 | |
---|
26 | |
---|
27 | pwg_query(' |
---|
28 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_product` ( |
---|
29 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, |
---|
30 | `order` int(20), |
---|
31 | `product` varchar(100) NOT NULL, |
---|
32 | `noteAdmin` varchar(255), |
---|
33 | `price` float NOT NULL, |
---|
34 | PRIMARY KEY (`id`) |
---|
35 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
36 | ;'); |
---|
37 | |
---|
38 | pwg_query(' |
---|
39 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_prod_img` ( |
---|
40 | `image_id` MEDIUMINT (20) UNSIGNED NOT NULL, |
---|
41 | `product_id` MEDIUMINT (20) UNSIGNED NOT NULL, |
---|
42 | PRIMARY KEY (`product_id`,`image_id`) |
---|
43 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
44 | ;'); |
---|
45 | |
---|
46 | pwg_query(' |
---|
47 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_option` ( |
---|
48 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, |
---|
49 | `name` varchar(250) NOT NULL, |
---|
50 | `type` varchar(100) NOT NULL, |
---|
51 | `titre` varchar(200), |
---|
52 | `requi` int(10), |
---|
53 | `order` int(20), |
---|
54 | |
---|
55 | PRIMARY KEY (`id`) |
---|
56 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
57 | ;'); |
---|
58 | |
---|
59 | pwg_query(' |
---|
60 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_opt_val` ( |
---|
61 | `id` int(11) unsigned NOT NULL AUTO_INCREMENT, |
---|
62 | `val` varchar(100) NOT NULL, |
---|
63 | `select_id` int(11) NOT NULL, |
---|
64 | PRIMARY KEY (`id`) |
---|
65 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
66 | ;'); |
---|
67 | |
---|
68 | pwg_query(' |
---|
69 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_prod_opt` ( |
---|
70 | `opt_id` MEDIUMINT (20) UNSIGNED NOT NULL, |
---|
71 | `product_id` MEDIUMINT (20) UNSIGNED NOT NULL, |
---|
72 | PRIMARY KEY (`product_id`,`opt_id`) |
---|
73 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
74 | ;'); |
---|
75 | |
---|
76 | $this->installed = true; |
---|
77 | } |
---|
78 | |
---|
79 | function activate($plugin_version, &$errors=array()) |
---|
80 | { |
---|
81 | if (!$this->installed) { |
---|
82 | $this->install($plugin_version, $errors); |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | function deactivate() |
---|
87 | { |
---|
88 | } |
---|
89 | |
---|
90 | function uninstall() |
---|
91 | { |
---|
92 | global $prefixeTable; |
---|
93 | // delete table |
---|
94 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_conf`;'); |
---|
95 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_product`;'); |
---|
96 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_prod_img`;'); |
---|
97 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_option`;'); |
---|
98 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_opt_val`;'); |
---|
99 | pwg_query('DROP TABLE `'. $prefixeTable .'mps_prod_opt`;'); |
---|
100 | } |
---|
101 | } |
---|
102 | |
---|
103 | |
---|