Last change
on this file since 11381 was
11381,
checked in by mistic100, 13 years ago
|
fix a Fatal Error & mistake with config param
|
File size:
1.5 KB
|
Line | |
---|
1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | function plugin_install() |
---|
5 | { |
---|
6 | global $prefixeTable; |
---|
7 | |
---|
8 | /* create table to store filters */ |
---|
9 | pwg_query( |
---|
10 | 'CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'category_filters` ( |
---|
11 | `category_id` smallint(5) unsigned NOT NULL, |
---|
12 | `type` varchar(16) NOT NULL, |
---|
13 | `cond` varchar(16) NULL, |
---|
14 | `value` text |
---|
15 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 |
---|
16 | ;'); |
---|
17 | |
---|
18 | /* add a collumn to image_category_table */ |
---|
19 | pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` ADD `smart` ENUM(\'true\', \'false\') NOT NULL DEFAULT \'false\';'); |
---|
20 | |
---|
21 | /* config parameter */ |
---|
22 | pwg_query(' |
---|
23 | INSERT INTO `' . CONFIG_TABLE . '` |
---|
24 | VALUES ( |
---|
25 | \'SmartAlbums\', |
---|
26 | \''.serialize(array( |
---|
27 | 'update_on_upload' => true, |
---|
28 | ) |
---|
29 | ).'\', |
---|
30 | \'Configuration for SmartAlbums plugin\' |
---|
31 | ) |
---|
32 | ;'); |
---|
33 | |
---|
34 | } |
---|
35 | |
---|
36 | function plugin_activate() |
---|
37 | { |
---|
38 | $sa_config = pwg_query('SELECT * FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';'); |
---|
39 | |
---|
40 | if (!pwg_db_num_rows($sa_config)) |
---|
41 | { |
---|
42 | pwg_query(' |
---|
43 | INSERT INTO `' . CONFIG_TABLE . '` |
---|
44 | VALUES ( |
---|
45 | \'SmartAlbums\', |
---|
46 | \''.serialize(array( |
---|
47 | 'update_on_upload' => true, |
---|
48 | ) |
---|
49 | ).'\', |
---|
50 | \'Configuration for SmartAlbums plugin\' |
---|
51 | ) |
---|
52 | ;'); |
---|
53 | } |
---|
54 | |
---|
55 | } |
---|
56 | |
---|
57 | function plugin_uninstall() |
---|
58 | { |
---|
59 | global $prefixeTable; |
---|
60 | |
---|
61 | pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;'); |
---|
62 | pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;'); |
---|
63 | pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\';'); |
---|
64 | } |
---|
65 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.