source: extensions/Random_Header/maintain.inc.php @ 7362

Last change on this file since 7362 was 7358, checked in by repie38, 13 years ago

moved conf file to db (_config table)
small fix on admin panel
new maintain procedures including upgrade from 2.1 or earlier (get conf from file and delete it)
deleted themes conf is no more stocked

File size: 2.4 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2009 Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23
24function plugin_install()
25{
26 global $conf;
27
28  if (!isset($conf['Random_Header']))
29  {
30  $q = '
31    INSERT INTO '.CONFIG_TABLE.' (param, value, comment)
32    VALUES ("Random_Header","","Random header configuration")
33  ;';
34  pwg_query($q);
35  } 
36 
37  // upgrade
38   
39        $x = file_get_contents( dirname(__FILE__).'/data.dat' );
40               
41        if ($x!==false) {
42                $query = '
43                                        UPDATE '.CONFIG_TABLE.'
44                                        SET value = "'.addslashes($x).'"
45                                        WHERE param = "Random_Header"
46                                        ;';
47                        if (pwg_query($query)) unlink( dirname(__FILE__).'/data.dat' );
48                       
49                }
50
51    // end upgrade
52 
53 
54}
55
56function plugin_uninstall()
57{
58  global $conf;
59  if (isset($conf['Random_Header']))
60  {
61    $q = '
62      DELETE FROM '.CONFIG_TABLE.'
63      WHERE param="Random_Header"
64    ;';
65    pwg_query($q);
66    }
67 }
68
69?>
Note: See TracBrowser for help on using the repository browser.