Last change
on this file since 26855 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
|
Rev | Line | |
---|
[3609] | 1 | <?php |
---|
[26665] | 2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
[3609] | 3 | |
---|
[26665] | 4 | class typetags_maintain extends PluginMaintain |
---|
[3609] | 5 | { |
---|
[26665] | 6 | private $installed = false; |
---|
[3609] | 7 | |
---|
[26665] | 8 | private $default_conf = array( |
---|
| 9 | 'show_all'=>true, |
---|
| 10 | ); |
---|
| 11 | |
---|
| 12 | function install($plugin_version, &$errors=array()) |
---|
[10987] | 13 | { |
---|
[26665] | 14 | global $conf, $prefixeTable; |
---|
[3609] | 15 | |
---|
[26665] | 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 | |
---|
[15149] | 28 | $query = ' |
---|
[26665] | 29 | CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'typetags` ( |
---|
[15149] | 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); |
---|
[26665] | 37 | |
---|
| 38 | $this->installed = true; |
---|
[10987] | 39 | } |
---|
[9863] | 40 | |
---|
[26665] | 41 | function activate($plugin_version, &$errors=array()) |
---|
[15149] | 42 | { |
---|
[26665] | 43 | if (!$this->installed) |
---|
| 44 | { |
---|
| 45 | $this->install($plugin_version, $errors); |
---|
| 46 | } |
---|
[15149] | 47 | } |
---|
| 48 | |
---|
[26665] | 49 | function deactivate() |
---|
| 50 | { |
---|
| 51 | } |
---|
[3609] | 52 | |
---|
[26665] | 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 | } |
---|
[3609] | 62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.