source: extensions/User_Info_Tracking/maintain.inc.php @ 25973

Revision 19700, 2.2 KB checked in by Charles2012, 7 years ago (diff)

Upload to SVN.

Line 
1<?php
2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
3
4defined('USER_INFO_TRACKING_ID') or define('USER_INFO_TRACKING_ID', basename(dirname(__FILE__)));
5include_once(PHPWG_PLUGINS_PATH . USER_INFO_TRACKING_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  user_info_tracking_install();
17  define('user_info_tracking_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('user_info_tracking_installed')) // a plugin is activated just after its installation
30  {
31    user_info_tracking_install();
32
33 
34//This is in here just for now.  When I am done coding I will remove it. 
35     $user_info_tracking_default_config = serialize(array(
36      'uiPerPage' => 25,
37      'uiDefaultSortColumn' => timeStamp,
38      'uiDefaultSortOrder' => ASC,
39      'uiDateFormat' => '%c',
40      ));
41 
42    conf_update_param('user_info_tracking', $user_info_tracking_default_config);
43    $conf['user_info_tracking'] = $user_info_tracking_default_config;
44// End of Additional Code
45
46
47  }
48}
49
50/**
51 * plugin unactivation
52 *
53 * triggered before uninstallation or by manual unactivation
54 */
55function plugin_unactivate()
56{
57}
58
59/**
60 * plugin uninstallation
61 *
62 * perform here all cleaning tasks when the plugin is removed
63 * you should revert all changes made by plugin_install()
64 */
65function plugin_uninstall() 
66{
67  global $prefixeTable;
68 
69  // delete configuration
70  pwg_query('DELETE FROM `'. CONFIG_TABLE .'` WHERE param = "user_info_tracking" LIMIT 1;');
71 
72  // delete table
73  pwg_query('DROP TABLE `'. $prefixeTable .'user_info_tracking`;');
74 
75  // delete field
76  pwg_query('ALTER `'. IMAGES_TABLE .'` DROP "user_info_tracking";');
77 
78  // delete local folder
79  $dir = PWG_LOCAL_DIR . 'user_info_tracking/';
80  foreach (scandir($dir) as $file)
81  {
82    if ($file == '.' or $file == '..') continue;
83    unlink($dir.$file);
84  }
85  rmdir($dir);
86}
87
88?>
Note: See TracBrowser for help on using the repository browser.