source: extensions/Comments_Access_Manager/maintain.inc.php @ 11017

Last change on this file since 11017 was 11017, checked in by Eric, 13 years ago

Initial release 2.2.0

  • Property svn:eol-style set to LF
File size: 1.3 KB
Line 
1<?php
2
3if(!defined('CM_PATH'))
4{
5  define('CM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/');
6}
7
8include_once (CM_PATH.'include/functions.inc.php');
9
10function plugin_install()
11{
12        global $conf;
13 
14  // Set current plugin version in config table
15  $plugin =  CM_Infos(CM_PATH);
16  $version = $plugin['version'];
17       
18  $default = array($version,'false','false',-1);
19
20        $query = '
21SELECT param
22  FROM '.CONFIG_TABLE.'
23WHERE param = "CommentsManager"
24;';
25  $count = pwg_db_num_rows(pwg_query($query));
26 
27  if ($count == 0)
28  {
29    $q = '
30INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
31VALUES ("CommentsManager","'.pwg_db_real_escape_string(serialize($default)).'","Comments Access Manager parameters")
32  ;';
33    pwg_query($q);
34  }
35}
36
37
38function plugin_activate()
39{
40  global $conf;
41
42/* Cleaning obsolete files */
43/* *********************** */
44  CM_Obsolete_Files();
45 
46  include_once (CM_PATH.'include/upgradedb.inc.php');
47
48  // Update plugin version number in #_config table and check consistency of #_plugins table
49  CM_version_update();
50
51  load_conf_from_db('param like \'UserAdvManager\\_%\'');
52}
53
54
55function plugin_uninstall()
56{
57  global $conf;
58
59  if (isset($conf['CommentsManager']))
60  {
61    $q = '
62DELETE FROM '.CONFIG_TABLE.'
63WHERE param="CommentsManager"
64;';
65
66    pwg_query($q);
67  }
68}
69?>
Note: See TracBrowser for help on using the repository browser.