source: extensions/community/include/install.inc.php @ 23037

Revision 23037, 3.2 KB checked in by plg, 7 years ago (diff)

manage quota (number of photos, disk usage)

Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2013 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 community_install()
25{
26  global $conf, $prefixeTable;
27   
28  $query = '
29CREATE TABLE IF NOT EXISTS '.$prefixeTable.'community_permissions (
30  id int(11) NOT NULL AUTO_INCREMENT,
31  type varchar(255) NOT NULL,
32  group_id smallint(5) unsigned DEFAULT NULL,
33  user_id smallint(5) DEFAULT NULL,
34  category_id smallint(5) unsigned DEFAULT NULL,
35  recursive enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
36  create_subcategories enum(\'true\',\'false\') NOT NULL DEFAULT \'false\',
37  moderated enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
38  nb_photos int DEFAULT NULL,
39  storage int DEFAULT NULL,
40  PRIMARY KEY (id)
41) ENGINE=MyISAM DEFAULT CHARSET=utf8
42;';
43  pwg_query($query);
44
45  $query = '
46CREATE TABLE IF NOT EXISTS '.$prefixeTable.'community_pendings (
47  image_id mediumint(8) unsigned NOT NULL,
48  state varchar(255) NOT NULL,
49  added_on datetime NOT NULL,
50  validated_by smallint(5) DEFAULT NULL
51) ENGINE=MyISAM DEFAULT CHARSET=utf8
52;';
53  pwg_query($query);
54
55  // column community_permissions.nb_photos added for version 2.5.d
56  $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'community_permissions` LIKE "nb_photos";');
57  if (!pwg_db_num_rows($result))
58  {     
59    pwg_query('ALTER TABLE `'.$prefixeTable .'community_permissions` ADD `nb_photos` INT DEFAULT NULL;');
60  }
61 
62  // column community_permissions.storage added for version 2.5.d
63  $result = pwg_query('SHOW COLUMNS FROM `'.$prefixeTable.'community_permissions` LIKE "storage";');
64  if (!pwg_db_num_rows($result))
65  {     
66    pwg_query('ALTER TABLE `'.$prefixeTable .'community_permissions` ADD `storage` INT DEFAULT NULL;');
67  }
68}
69?>
Note: See TracBrowser for help on using the repository browser.