source: extensions/UserCollections/maintain.inc.php @ 16591

Last change on this file since 16591 was 16591, checked in by mistic100, 9 years ago

first commit

File size: 1.1 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4function plugin_install() 
5{
6  global $conf, $prefixeTable;
7 
8  $query = '
9CREATE 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 = '
23CREATE 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
32function plugin_activate()
33{}
34
35function 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?>
Note: See TracBrowser for help on using the repository browser.