source: extensions/nbc_HistoryIPExcluder/trunk/maintain.inc.php @ 5099

Last change on this file since 5099 was 5099, checked in by Eric, 14 years ago

[nbc_HistoryIPExcluder] Initial SVN creation

  • Trunk directory created with beta version of next plugin version for Piwigo
  • Branche 2.0 created
  • Tags directory created
  • Property svn:eol-style set to LF
File size: 1.2 KB
Line 
1<?php
2
3function plugin_install()
4{
5  global $conf;
6 
7  $default= array();
8
9  $q = '
10INSERT INTO '.CONFIG_TABLE.' (param,value,comment)
11VALUES ("nbc_HistoryIPExcluder","'.addslashes(serialize($default)).'","Parametres nbc History IP Excluder");
12';
13     
14  pwg_query($q);
15}
16
17function plugin_activate()
18{
19  global $conf;
20
21/* Serializing conf parameters */
22/* *************************** */
23  if (unserialize($conf['nbc_HistoryIPExcluder']) === false)
24  {
25  /* upgrade from branch old version to 2.0.0 */
26  /* **************************************** */
27    upgrade_200();
28  }
29 
30}
31
32function plugin_uninstall()
33{
34  global $conf;
35
36  if (isset($conf['nbc_HistoryIPExcluder']))
37  {
38    $q = '
39DELETE FROM '.CONFIG_TABLE.'
40WHERE param="nbc_HistoryIPExcluder" LIMIT 1;
41';
42
43    pwg_query($q);
44  }
45}
46
47/* upgrade from old version to 2.0.0 */
48/* ********************************* */
49function upgrade_200()
50{
51        global $conf;
52 
53  if (unserialize($conf['nbc_HistoryIPExcluder']) === false)
54  {
55    $data = explode(',', $conf['nbc_HistoryIPExcluder']);
56
57    $query = '
58UPDATE '.CONFIG_TABLE.'
59  SET value = "'.addslashes(serialize($data)).'"
60  WHERE param = "nbc_HistoryIPExcluder"
61;';
62    pwg_query($query);
63  }
64}
65
66?>
Note: See TracBrowser for help on using the repository browser.