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

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

Bug fixed : Installation from scratch error.
Bug fixed : If "Comments for all" is disabled and a specified group of users can post comments without admin validation, the administrator had to still validate them.
New version 2.2.4 hard coded for publication

  • Property svn:eol-style set to LF
File size: 1.7 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,'false',-1,'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  // Database upgrade process
49  if (isset($conf['CommentsManager']))
50  {
51    $conf_CM = unserialize($conf['CommentsManager']);
52   
53    // upgrade from 2.2.0 to 2.2.1
54    if (version_compare($conf_CM[0], '2.2.1') < 0)
55    {
56      upgradeCM_220_221();
57    }
58
59    // upgrade from 2.2.1 to 2.2.2
60    if (version_compare($conf_CM[0], '2.2.2') < 0)
61    {
62      upgradeCM_221_222();
63    }
64  }
65 
66  // Update plugin version number in #_config table and check consistency of #_plugins table
67  CM_version_update();
68
69  load_conf_from_db('param like \'CommentsManager\'');
70}
71
72
73function plugin_uninstall()
74{
75  global $conf;
76
77  if (isset($conf['CommentsManager']))
78  {
79    $q = '
80DELETE FROM '.CONFIG_TABLE.'
81WHERE param="CommentsManager"
82;';
83
84    pwg_query($q);
85  }
86}
87?>
Note: See TracBrowser for help on using the repository browser.