[17899] | 1 | <?php |
---|
| 2 | defined('PHPWG_ROOT_PATH') or die('Hacking attempt!'); |
---|
| 3 | |
---|
[17924] | 4 | defined('SKELETON_ID') or define('SKELETON_ID', basename(dirname(__FILE__))); |
---|
| 5 | include_once(PHPWG_PLUGINS_PATH . SKELETON_ID . '/include/install.inc.php'); |
---|
[17899] | 6 | |
---|
| 7 | /** |
---|
| 8 | * plugin installation |
---|
| 9 | * |
---|
| 10 | * perform here all needed step for the plugin installation |
---|
| 11 | * such as create default config, add database tables, |
---|
| 12 | * add fields to existing tables, create local folders... |
---|
| 13 | */ |
---|
| 14 | function plugin_install() |
---|
| 15 | { |
---|
| 16 | skeleton_install(); |
---|
| 17 | define('skeleton_installed', true); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | /** |
---|
| 21 | * plugin activation |
---|
| 22 | * |
---|
| 23 | * this function is triggered adter installation, by manual activation |
---|
| 24 | * or after a plugin update |
---|
| 25 | * for this last case you must manage updates tasks of your plugin in this function |
---|
| 26 | */ |
---|
| 27 | function plugin_activate() |
---|
| 28 | { |
---|
| 29 | if (!defined('skeleton_installed')) // a plugin is activated just after its installation |
---|
| 30 | { |
---|
| 31 | skeleton_install(); |
---|
| 32 | } |
---|
| 33 | } |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * plugin unactivation |
---|
| 37 | * |
---|
| 38 | * triggered before uninstallation or by manual unactivation |
---|
| 39 | */ |
---|
| 40 | function plugin_unactivate() |
---|
| 41 | { |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * plugin uninstallation |
---|
| 46 | * |
---|
| 47 | * perform here all cleaning tasks when the plugin is removed |
---|
| 48 | * you should revert all changes made by plugin_install() |
---|
| 49 | */ |
---|
| 50 | function plugin_uninstall() |
---|
| 51 | { |
---|
| 52 | global $prefixeTable; |
---|
| 53 | |
---|
| 54 | // delete configuration |
---|
| 55 | pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "skeleton" LIMIT 1;'); |
---|
| 56 | |
---|
| 57 | // delete table |
---|
[17924] | 58 | pwg_query('DROP TABLE `'. $prefixeTable .'skeleton`;'); |
---|
[17899] | 59 | |
---|
| 60 | // delete field |
---|
[19842] | 61 | pwg_query('ALTER TABLE `'. IMAGES_TABLE .'` DROP `skeleton`;'); |
---|
[17899] | 62 | |
---|
| 63 | // delete local folder |
---|
[19842] | 64 | $dir = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'skeleton/'; |
---|
[17899] | 65 | foreach (scandir($dir) as $file) |
---|
| 66 | { |
---|
| 67 | if ($file == '.' or $file == '..') continue; |
---|
[18050] | 68 | unlink($dir.$file); |
---|
[17899] | 69 | } |
---|
[18050] | 70 | rmdir($dir); |
---|
[17899] | 71 | } |
---|
| 72 | |
---|
| 73 | ?> |
---|