source: branches/2.3/install/db/104-database.php @ 12344

Last change on this file since 12344 was 10653, checked in by patdenice, 14 years ago

Insert upload form parameters in database during installation.
Remove prepare_upload_configuration function.

File size: 2.6 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2011 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
24if (!defined('PHPWG_ROOT_PATH'))
25{
26  die('Hacking attempt!');
27}
28
29$upgrade_description = 'Add upload form parameters in database';
30
31global $conf;
32
33load_conf_from_db();
34
35$upload_form_config = array(
36  'websize_resize' => true,
37  'websize_maxwidth' => 800,
38  'websize_maxheight' => 600,
39  'websize_quality' => 95,
40  'thumb_maxwidth' => 128,
41  'thumb_maxheight' => 96,
42  'thumb_quality' => 95,
43  'thumb_crop' => false,
44  'thumb_follow_orientation' => true,
45  'hd_keep' => true,
46  'hd_resize' => false,
47  'hd_maxwidth' => 2000,
48  'hd_maxheight' => 2000,
49  'hd_quality' => 95,
50);
51
52$inserts = array();
53
54foreach ($upload_form_config as $param_shortname => $param)
55{
56  $param_name = 'upload_form_'.$param_shortname;
57
58  if (!isset($conf[$param_name]))
59  {
60    $conf[$param_name] = $param;
61   
62    array_push(
63      $inserts,
64      array(
65        'param' => $param_name,
66        'value' => boolean_to_string($param),
67        )
68      );
69  }
70}
71
72if (count($inserts) > 0)
73{
74  mass_inserts(
75    CONFIG_TABLE,
76    array_keys($inserts[0]),
77    $inserts
78    );
79}
80
81echo
82"\n"
83. $upgrade_description
84."\n"
85;
86?>
Note: See TracBrowser for help on using the repository browser.