1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008 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 | |
---|
24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
25 | { |
---|
26 | die('Hacking attempt!'); |
---|
27 | } |
---|
28 | |
---|
29 | $upgrade_description = 'Update template preference for every user'; |
---|
30 | |
---|
31 | // +-----------------------------------------------------------------------+ |
---|
32 | // | Upgrade content | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | |
---|
35 | // configuration update |
---|
36 | $query = ' |
---|
37 | UPDATE '.PREFIX_TABLE.'config |
---|
38 | SET value = \'yoga/clear\' |
---|
39 | WHERE param = \'default_template\' |
---|
40 | ;'; |
---|
41 | pwg_query($query); |
---|
42 | |
---|
43 | // set yoga/clear as default value for user_infos.template column |
---|
44 | $query = ' |
---|
45 | ALTER TABLE '.PREFIX_TABLE.'user_infos |
---|
46 | CHANGE COLUMN template template varchar(255) NOT NULL default \'yoga/clear\' |
---|
47 | ;'; |
---|
48 | pwg_query($query); |
---|
49 | |
---|
50 | // users having yoga-dark for template now have yoga/dark |
---|
51 | $query = ' |
---|
52 | UPDATE '.PREFIX_TABLE.'user_infos |
---|
53 | SET template = \'yoga/dark\' |
---|
54 | WHERE template = \'yoga-dark\' |
---|
55 | ;'; |
---|
56 | pwg_query($query); |
---|
57 | |
---|
58 | // all other users have yoga/clear |
---|
59 | $query = ' |
---|
60 | UPDATE '.PREFIX_TABLE.'user_infos |
---|
61 | SET template = \'yoga/clear\' |
---|
62 | WHERE template != \'yoga/dark\' |
---|
63 | ;'; |
---|
64 | pwg_query($query); |
---|
65 | |
---|
66 | echo |
---|
67 | "\n" |
---|
68 | .'Default template modified to yoga/clear' |
---|
69 | ."\n" |
---|
70 | .'Template preference modified for every users : yoga/dark' |
---|
71 | .' (for yoga-dark users) and yoga/clear as default' |
---|
72 | ."\n" |
---|
73 | ; |
---|
74 | ?> |
---|