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

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

first commit

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