source: extensions/typetags/maintain.inc.php @ 9752

Last change on this file since 9752 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 912 bytes
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5function plugin_install()
6{
7  global $prefixeTable;
8
9  $query = 'SHOW FULL COLUMNS FROM ' . TAGS_TABLE . ';';
10  $result = array_from_query($query, 'Field');
11  if (!in_array('id_typetags', $result))
12  {
13    pwg_query('ALTER TABLE '.TAGS_TABLE.' ADD COLUMN `id_typetags` SMALLINT(5)');
14  }
15
16  $result = pwg_query('SHOW TABLES LIKE "' . $prefixeTable .'typetags"');
17  if (!mysql_fetch_row($result))
18  {
19    $q = 'CREATE TABLE '. $prefixeTable .'typetags(
20      id smallint(5) unsigned NOT NULL auto_increment,
21      name VARCHAR(255) NOT NULL,
22      color VARCHAR(255) NOT NULL,
23      PRIMARY KEY  (id));';
24    pwg_query($q);
25  }
26}
27 
28function plugin_uninstall()
29{
30  global $prefixeTable;
31
32  $q = ' ALTER TABLE '.TAGS_TABLE.' DROP COLUMN `id_typetags`';
33  pwg_query( $q );
34
35  $q = ' DROP TABLE '. $prefixeTable .'typetags;';
36  pwg_query($q);
37}
38 
39?>
Note: See TracBrowser for help on using the repository browser.