source: extensions/Comments_on_Albums/include/install.inc.php @ 18927

Last change on this file since 18927 was 18927, checked in by mistic100, 11 years ago

update with Piwigo 2.5 features (website url, email, mandatory email and username)

File size: 1.5 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4function coa_install() 
5{
6  global $prefixeTable;
7 
8  pwg_query('
9CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'comments_categories` (
10  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
11  `category_id` mediumint(8) unsigned NOT NULL DEFAULT 0,
12  `date` datetime NOT NULL DEFAULT "0000-00-00 00:00:00",
13  `author` varchar(255) DEFAULT NULL,
14  `email` varchar(255) DEFAULT NULL,
15  `author_id` smallint(5) DEFAULT NULL,
16  `anonymous_id` varchar(45) NOT NULL,
17  `website_url` varchar(255) DEFAULT NULL,
18  `content` longtext,
19  `validated` enum("true","false") NOT NULL DEFAULT "false",
20  `validation_date` datetime DEFAULT NULL,
21  PRIMARY KEY (`id`),
22  KEY `comments_i2` (`validation_date`),
23  KEY `comments_i1` (`category_id`)
24) ENGINE=MyISAM DEFAULT CHARSET=utf8');
25 
26  $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories` LIKE "anonymous_id";');
27  if (!pwg_db_num_rows($result))
28  {     
29    pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories` ADD `anonymous_id` VARCHAR( 45 ) DEFAULT NULL;');
30  }
31 
32  $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'comments_categories` LIKE "email";');
33  if (!pwg_db_num_rows($result))
34  {     
35    pwg_query('ALTER TABLE `' . $prefixeTable . 'comments_categories`
36      ADD `email` varchar(255) DEFAULT NULL,
37      ADD `website_url` varchar(255) DEFAULT NULL,
38      ADD KEY `comments_i2` (`validation_date`),
39      ADD KEY `comments_i1` (`category_id`)
40      ;');
41  }
42}
43
44?>
Note: See TracBrowser for help on using the repository browser.