1 | <?php |
---|
2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
3 | |
---|
4 | function plugin_install() { |
---|
5 | global $prefixeTable; |
---|
6 | |
---|
7 | require_once('install/functions.inc.php'); |
---|
8 | |
---|
9 | $query = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
10 | $result = pwg_query($query); |
---|
11 | if (!pwg_db_fetch_row($result)) { |
---|
12 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
13 | piwecard_conf_create('piwecard'); |
---|
14 | } |
---|
15 | } |
---|
16 | |
---|
17 | function plugin_activate() { |
---|
18 | global $prefixeTable; |
---|
19 | |
---|
20 | require_once('install/functions.inc.php'); |
---|
21 | |
---|
22 | $query_ecard = 'SHOW TABLES LIKE "'.$prefixeTable.'ecard"'; |
---|
23 | $result_ecard = pwg_query($query_ecard); |
---|
24 | $query_piwecard = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
25 | $result_piwecard = pwg_query($query_piwecard); |
---|
26 | if (pwg_db_num_rows($result_ecard) != 0) { //Update old configs |
---|
27 | if (pwg_db_num_rows($result_piwecard) == 0){ |
---|
28 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
29 | piwecard_db_update_from_2_3($prefixeTable.'ecard', $prefixeTable.'piwecard'); |
---|
30 | } |
---|
31 | piwecard_db_delete($prefixeTable.'ecard'); |
---|
32 | |
---|
33 | piwecard_conf_rename('ecard', 'piwecard'); |
---|
34 | } |
---|
35 | |
---|
36 | $query_unique_id = 'SHOW COLUMNS FROM '.$prefixeTable.'piwecard LIKE "unique_id"'; |
---|
37 | $result_unique_id = pwg_query($query_unique_id); |
---|
38 | if(pwg_db_num_rows($result_unique_id) == 0) { |
---|
39 | piwecard_db_update_from_2_4a_b3($prefixeTable.'piwecard'); |
---|
40 | } |
---|
41 | } |
---|
42 | |
---|
43 | function plugin_uninstall() { |
---|
44 | global $prefixeTable; |
---|
45 | |
---|
46 | require_once('install/functions.inc.php'); |
---|
47 | |
---|
48 | piwecard_db_delete($prefixeTable.'piwecard'); |
---|
49 | piwecard_conf_delete('piwecard'); |
---|
50 | } |
---|
51 | ?> |
---|