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

Last change on this file since 27318 was 26665, checked in by mistic100, 10 years ago

integrate in new tags manager + rename in Coloured Tags
(my apologies to translators :-) )

File size: 1.4 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4class typetags_maintain extends PluginMaintain
5{
6  private $installed = false;
7
8  private $default_conf = array(
9    'show_all'=>true,
10    );
11
12  function install($plugin_version, &$errors=array())
13  {
14    global $conf, $prefixeTable;
15
16    if (empty($conf['TypeTags']))
17    {
18      $conf['TypeTags'] = serialize($this->default_conf);
19      conf_update_param('TypeTags', $conf['TypeTags']);
20    }
21
22    $result = pwg_query('SHOW COLUMNS FROM `' . TAGS_TABLE . '` LIKE "id_typetags";');
23    if (!pwg_db_num_rows($result))
24    {
25      pwg_query('ALTER TABLE `' . TAGS_TABLE . '` ADD `id_typetags` SMALLINT(5) DEFAULT NULL;');
26    }
27
28    $query = '
29CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'typetags` (
30  `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
31  `name` varchar(255) NOT NULL,
32  `color` varchar(255) NOT NULL,
33  PRIMARY KEY (`id`)
34) DEFAULT CHARSET=utf8
35;';
36    pwg_query($query);
37
38    $this->installed = true;
39  }
40
41  function activate($plugin_version, &$errors=array())
42  {
43    if (!$this->installed)
44    {
45      $this->install($plugin_version, $errors);
46    }
47  }
48
49  function deactivate()
50  {
51  }
52
53  function uninstall()
54  {
55    global $prefixeTable;
56
57    conf_delete_param('TypeTags');
58
59    pwg_query('ALTER TABLE `' . TAGS_TABLE . '` DROP `id_typetags`');
60    pwg_query('DROP TABLE `' . $prefixeTable . 'typetags`;');
61  }
62}
Note: See TracBrowser for help on using the repository browser.