[27568] | 1 | <?php |
---|
| 2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 3 | |
---|
[27743] | 4 | class MyPiwiShop_maintain extends PluginMaintain |
---|
[27568] | 5 | { |
---|
| 6 | private $installed = false; |
---|
| 7 | |
---|
[27743] | 8 | |
---|
[27568] | 9 | function install($plugin_version, &$errors=array()) |
---|
| 10 | { |
---|
[27589] | 11 | global $prefixeTable; |
---|
[27743] | 12 | |
---|
| 13 | pwg_query(' |
---|
| 14 | CREATE TABLE IF NOT EXISTS `'. $prefixeTable .'mps_conf` ( |
---|
[27568] | 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 |
---|
[27743] | 24 | ;'); |
---|
[27568] | 25 | |
---|
[27589] | 26 | |
---|
[27568] | 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 | ;'); |
---|
[27589] | 37 | |
---|
[27568] | 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 | ;'); |
---|
[27589] | 45 | |
---|
[27568] | 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 | ;'); |
---|
[27743] | 75 | |
---|
[27781] | 76 | $this->installed = true; |
---|
[27589] | 77 | } |
---|
[27568] | 78 | |
---|
[27781] | 79 | function activate($plugin_version, &$errors=array()) |
---|
[27568] | 80 | { |
---|
[27781] | 81 | if (!$this->installed) { |
---|
| 82 | $this->install($plugin_version, $errors); |
---|
| 83 | } |
---|
[27568] | 84 | } |
---|
[27743] | 85 | |
---|
[27568] | 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`;'); |
---|
[27781] | 100 | } |
---|
[27568] | 101 | } |
---|
| 102 | |
---|
| 103 | |
---|