source: extensions/skeleton/maintain.inc.php @ 20796

Last change on this file since 20796 was 19842, checked in by mistic100, 12 years ago

some little fixes

File size: 1.7 KB
Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4defined('SKELETON_ID') or define('SKELETON_ID', basename(dirname(__FILE__)));
5include_once(PHPWG_PLUGINS_PATH . SKELETON_ID . '/include/install.inc.php');
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 */
14function 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 */
27function 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 */
40function 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 */
50function 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
58  pwg_query('DROP TABLE `'. $prefixeTable .'skeleton`;');
59 
60  // delete field
61  pwg_query('ALTER TABLE `'. IMAGES_TABLE .'` DROP `skeleton`;');
62 
63  // delete local folder
64  $dir = PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'skeleton/';
65  foreach (scandir($dir) as $file)
66  {
67    if ($file == '.' or $file == '..') continue;
68    unlink($dir.$file);
69  }
70  rmdir($dir);
71}
72
73?>
Note: See TracBrowser for help on using the repository browser.