Changeset 19956 for extensions/Piwecard/maintain.inc.php
- Timestamp:
- Jan 7, 2013, 10:26:35 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Piwecard/maintain.inc.php
r19925 r19956 1 1 <?php 2 /*3 * Plugin Name: Piwecard4 * File : maintain.inc.php5 */6 7 2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); 8 3 9 4 function plugin_install() { 10 global $prefixeTable , $conf;5 global $prefixeTable; 11 6 12 $query = 'SHOW TABLES LIKE "' . $prefixeTable . 'ecard"'; 7 require_once('install/functions.inc.php'); 8 9 $query = 'SHOW TABLES LIKE "'.$prefixeTable.'piwecard"'; 13 10 $result = pwg_query($query); 14 if (!mysql_fetch_row($result)) { 15 16 // ecard description 17 $q = 'CREATE TABLE `' . $prefixeTable . 'ecard` ( 18 `numero` CHAR(64) not null, 19 `nomexp` CHAR(100) not null, 20 `nomdest` CHAR(100) not null, 21 `adrexp` CHAR(100) not null, 22 `adrdest` CHAR(100) not null, 23 `sujet` CHAR(100) not null, 24 `message` TEXT not null, 25 `image` smallint(5) not null, 26 `date` datetime NOT NULL, 27 `duration` smallint(5) not null default 10, 28 PRIMARY KEY (`numero`), 29 UNIQUE (`numero`) 30 ) DEFAULT CHARSET=utf8;'; 31 pwg_query($q); 32 33 $q = ' 34 INSERT INTO '.CONFIG_TABLE.' (param,value,comment) 35 VALUES ("ecard","","Configuration ecard") 36 ;'; 37 38 pwg_query($q); 11 if (!pwg_db_fetch_row($result)) { 12 piwecard_db_create($prefixeTable.'piwecard'); 13 piwecard_conf_create('piwecard'); 39 14 } 40 15 } 41 16 42 17 function plugin_activate() { 43 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_populate($prefixeTable.'ecard', $prefixeTable.'piwecard'); 30 } 31 piwecard_db_delete($prefixeTable.'ecard'); 32 33 piwecard_conf_rename('ecard', 'piwecard'); 34 } 44 35 } 45 36 46 37 function plugin_uninstall() { 47 38 global $prefixeTable; 48 39 49 $q = 'DROP TABLE ' . $prefixeTable . 'ecard;'; 50 pwg_query($q); 51 52 $q = ' 53 DELETE FROM '.CONFIG_TABLE.' 54 WHERE param="ecard" LIMIT 1 55 ;'; 56 pwg_query($q); 40 require_once('install/functions.inc.php'); 41 42 piwecard_db_delete($prefixeTable.'piwecard'); 43 piwecard_conf_delete('piwecard'); 57 44 } 58 45 ?>
Note: See TracChangeset
for help on using the changeset viewer.