aboutsummaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rw-r--r--install/db/143-database.php60
-rw-r--r--install/piwigo_structure-mysql.sql28
2 files changed, 74 insertions, 14 deletions
diff --git a/install/db/143-database.php b/install/db/143-database.php
new file mode 100644
index 000000000..84d9a9467
--- /dev/null
+++ b/install/db/143-database.php
@@ -0,0 +1,60 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify |
+// | it under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation |
+// | |
+// | This program is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with this program; if not, write to the Free Software |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA. |
+// +-----------------------------------------------------------------------+
+
+if (!defined('PHPWG_ROOT_PATH'))
+{
+ die('Hacking attempt!');
+}
+
+$upgrade_description = 'enlarge your user_id (16 millions possible users)';
+
+// we use PREFIX_TABLE, in case Piwigo uses an external user table
+pwg_query('ALTER TABLE '.PREFIX_TABLE.'users CHANGE id id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT;');
+pwg_query('ALTER TABLE '.IMAGES_TABLE.' CHANGE added_by added_by MEDIUMINT UNSIGNED NOT NULL DEFAULT \'0\';');
+pwg_query('ALTER TABLE '.COMMENTS_TABLE.' CHANGE author_id author_id MEDIUMINT UNSIGNED DEFAULT NULL;');
+
+$tables = array(
+ USER_ACCESS_TABLE,
+ USER_CACHE_TABLE,
+ USER_FEED_TABLE,
+ USER_GROUP_TABLE,
+ USER_INFOS_TABLE,
+ USER_CACHE_CATEGORIES_TABLE,
+ USER_MAIL_NOTIFICATION_TABLE,
+ RATE_TABLE,
+ CADDIE_TABLE,
+ FAVORITES_TABLE,
+ HISTORY_TABLE,
+ );
+
+foreach ($tables as $table)
+{
+ pwg_query('
+ALTER TABLE '.$table.'
+ CHANGE user_id user_id MEDIUMINT UNSIGNED NOT NULL DEFAULT \'0\'
+;');
+}
+
+echo "\n".$upgrade_description."\n";
+
+?>
diff --git a/install/piwigo_structure-mysql.sql b/install/piwigo_structure-mysql.sql
index c05dcb981..84b07a3a5 100644
--- a/install/piwigo_structure-mysql.sql
+++ b/install/piwigo_structure-mysql.sql
@@ -10,7 +10,7 @@
DROP TABLE IF EXISTS `piwigo_caddie`;
CREATE TABLE `piwigo_caddie` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`element_id` mediumint(8) NOT NULL default '0',
PRIMARY KEY (`user_id`,`element_id`)
) ENGINE=MyISAM;
@@ -54,7 +54,7 @@ CREATE TABLE `piwigo_comments` (
`date` datetime NOT NULL default '0000-00-00 00:00:00',
`author` varchar(255) default NULL,
`email` varchar(255) default NULL,
- `author_id` smallint(5) DEFAULT NULL,
+ `author_id` mediumint(8) unsigned DEFAULT NULL,
`anonymous_id` varchar(45) NOT NULL,
`website_url` varchar(255) DEFAULT NULL,
`content` longtext,
@@ -83,7 +83,7 @@ CREATE TABLE `piwigo_config` (
DROP TABLE IF EXISTS `piwigo_favorites`;
CREATE TABLE `piwigo_favorites` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`image_id` mediumint(8) unsigned NOT NULL default '0',
PRIMARY KEY (`user_id`,`image_id`)
) ENGINE=MyISAM;
@@ -123,7 +123,7 @@ CREATE TABLE `piwigo_history` (
`id` int(10) unsigned NOT NULL auto_increment,
`date` date NOT NULL default '0000-00-00',
`time` time NOT NULL default '00:00:00',
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`IP` varchar(15) NOT NULL default '',
`section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL,
`category_id` smallint(5) default NULL,
@@ -199,7 +199,7 @@ CREATE TABLE `piwigo_images` (
`storage_category_id` smallint(5) unsigned default NULL,
`level` tinyint unsigned NOT NULL default '0',
`md5sum` char(32) default NULL,
- `added_by` smallint(5) NOT NULL default '0',
+ `added_by` mediumint(8) unsigned NOT NULL default '0',
`rotation` tinyint unsigned default NULL,
`latitude` double(8, 6) default NULL,
`longitude` double(9, 6) default NULL,
@@ -258,7 +258,7 @@ CREATE TABLE `piwigo_plugins` (
DROP TABLE IF EXISTS `piwigo_rate`;
CREATE TABLE `piwigo_rate` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`element_id` mediumint(8) unsigned NOT NULL default '0',
`anonymous_id` varchar(45) NOT NULL default '',
`rate` tinyint(2) unsigned NOT NULL default '0',
@@ -347,7 +347,7 @@ CREATE TABLE `piwigo_upgrade` (
DROP TABLE IF EXISTS `piwigo_user_access`;
CREATE TABLE `piwigo_user_access` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`cat_id` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`user_id`,`cat_id`)
) ENGINE=MyISAM;
@@ -358,7 +358,7 @@ CREATE TABLE `piwigo_user_access` (
DROP TABLE IF EXISTS `piwigo_user_cache`;
CREATE TABLE `piwigo_user_cache` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`need_update` enum('true','false') NOT NULL default 'true',
`cache_update_time` integer unsigned NOT NULL default 0,
`forbidden_categories` mediumtext,
@@ -377,7 +377,7 @@ CREATE TABLE `piwigo_user_cache` (
DROP TABLE IF EXISTS `piwigo_user_cache_categories`;
CREATE TABLE `piwigo_user_cache_categories` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`cat_id` smallint(5) unsigned NOT NULL default '0',
`date_last` datetime default NULL,
`max_date_last` datetime default NULL,
@@ -396,7 +396,7 @@ CREATE TABLE `piwigo_user_cache_categories` (
DROP TABLE IF EXISTS `piwigo_user_feed`;
CREATE TABLE `piwigo_user_feed` (
`id` varchar(50) binary NOT NULL default '',
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`last_check` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
@@ -407,7 +407,7 @@ CREATE TABLE `piwigo_user_feed` (
DROP TABLE IF EXISTS `piwigo_user_group`;
CREATE TABLE `piwigo_user_group` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`group_id` smallint(5) unsigned NOT NULL default '0',
PRIMARY KEY (`group_id`,`user_id`)
) ENGINE=MyISAM;
@@ -418,7 +418,7 @@ CREATE TABLE `piwigo_user_group` (
DROP TABLE IF EXISTS `piwigo_user_infos`;
CREATE TABLE `piwigo_user_infos` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`nb_image_page` smallint(3) unsigned NOT NULL default '15',
`status` enum('webmaster','admin','normal','generic','guest') NOT NULL default 'guest',
`language` varchar(50) NOT NULL default 'en_UK',
@@ -442,7 +442,7 @@ CREATE TABLE `piwigo_user_infos` (
DROP TABLE IF EXISTS `piwigo_user_mail_notification`;
CREATE TABLE `piwigo_user_mail_notification` (
- `user_id` smallint(5) NOT NULL default '0',
+ `user_id` mediumint(8) unsigned NOT NULL default '0',
`check_key` varchar(16) binary NOT NULL default '',
`enabled` enum('true','false') NOT NULL default 'false',
`last_send` datetime default NULL,
@@ -456,7 +456,7 @@ CREATE TABLE `piwigo_user_mail_notification` (
DROP TABLE IF EXISTS `piwigo_users`;
CREATE TABLE `piwigo_users` (
- `id` smallint(5) NOT NULL auto_increment,
+ `id` mediumint(8) unsigned NOT NULL auto_increment,
`username` varchar(100) binary NOT NULL default '',
`password` varchar(255) default NULL,
`mail_address` varchar(255) default NULL,