[8771] | 1 | <?php |
---|
| 2 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 3 | |
---|
[19732] | 4 | function plugin_install() { |
---|
[19956] | 5 | global $prefixeTable; |
---|
[8771] | 6 | |
---|
[19956] | 7 | require_once('install/functions.inc.php'); |
---|
| 8 | |
---|
| 9 | $query = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; |
---|
[8771] | 10 | $result = pwg_query($query); |
---|
[19956] | 11 | if (!pwg_db_fetch_row($result)) { |
---|
| 12 | piwecard_db_create($prefixeTable.'piwecard'); |
---|
| 13 | piwecard_conf_create('piwecard'); |
---|
[8771] | 14 | } |
---|
| 15 | } |
---|
| 16 | |
---|
[19732] | 17 | function plugin_activate() { |
---|
[19956] | 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'); |
---|
[20202] | 29 | piwecard_db_update_from_2_3($prefixeTable.'ecard', $prefixeTable.'piwecard'); |
---|
[19956] | 30 | } |
---|
| 31 | piwecard_db_delete($prefixeTable.'ecard'); |
---|
| 32 | |
---|
| 33 | piwecard_conf_rename('ecard', 'piwecard'); |
---|
| 34 | } |
---|
[20202] | 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 | } |
---|
[8771] | 41 | } |
---|
| 42 | |
---|
[19732] | 43 | function plugin_uninstall() { |
---|
[19956] | 44 | global $prefixeTable; |
---|
[8771] | 45 | |
---|
[19956] | 46 | require_once('install/functions.inc.php'); |
---|
| 47 | |
---|
| 48 | piwecard_db_delete($prefixeTable.'piwecard'); |
---|
| 49 | piwecard_conf_delete('piwecard'); |
---|
[8771] | 50 | } |
---|
| 51 | ?> |
---|