/web/test/gallery/phpwebgallery/install/_vti_cnf/config.sql |
---|
0,0 → 1,6 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|17 Jan 2005 18:09:48 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_cacheddtm:TX|17 Jan 2005 18:09:48 -0000 |
vti_filesize:IR|3750 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/dbscheme.txt |
---|
0,0 → 1,6 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|20 Dec 2004 11:30:36 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_cacheddtm:TX|20 Dec 2004 11:30:36 -0000 |
vti_filesize:IR|12670 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/phpwebgallery_structure.sql |
---|
0,0 → 1,6 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|20 Dec 2004 11:30:36 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_cacheddtm:TX|20 Dec 2004 11:30:36 -0000 |
vti_filesize:IR|8125 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/upgrade_1.3.0.php |
---|
0,0 → 1,14 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|07 Jan 2005 22:10:52 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_author:SR|KAKLIK\\Jakub |
vti_modifiedby:SR|KAKLIK\\Jakub |
vti_timecreated:TR|07 Jan 2005 22:10:52 -0000 |
vti_cacheddtm:TX|07 Jan 2005 22:10:52 -0000 |
vti_filesize:IR|10011 |
vti_cachedneedsrewrite:BR|false |
vti_cachedhasbots:BR|false |
vti_cachedhastheme:BR|false |
vti_cachedhasborder:BR|false |
vti_charset:SR|windows-1250 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/upgrade_1.3.1.php |
---|
0,0 → 1,14 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|07 Jan 2005 22:10:52 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_author:SR|KAKLIK\\Jakub |
vti_modifiedby:SR|KAKLIK\\Jakub |
vti_timecreated:TR|07 Jan 2005 22:10:52 -0000 |
vti_cacheddtm:TX|07 Jan 2005 22:10:52 -0000 |
vti_filesize:IR|9013 |
vti_cachedneedsrewrite:BR|false |
vti_cachedhasbots:BR|false |
vti_cachedhastheme:BR|false |
vti_cachedhasborder:BR|false |
vti_charset:SR|windows-1250 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/upgrade_1.3.2.php |
---|
0,0 → 1,14 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|07 Jan 2005 22:10:52 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_author:SR|KAKLIK\\Jakub |
vti_modifiedby:SR|KAKLIK\\Jakub |
vti_timecreated:TR|07 Jan 2005 22:10:52 -0000 |
vti_cacheddtm:TX|07 Jan 2005 22:10:52 -0000 |
vti_filesize:IR|8996 |
vti_cachedneedsrewrite:BR|false |
vti_cachedhasbots:BR|false |
vti_cachedhastheme:BR|false |
vti_cachedhasborder:BR|false |
vti_charset:SR|windows-1250 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/upgrade_1.3.3.php |
---|
0,0 → 1,14 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|07 Jan 2005 22:10:52 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_author:SR|KAKLIK\\Jakub |
vti_modifiedby:SR|KAKLIK\\Jakub |
vti_timecreated:TR|07 Jan 2005 22:10:52 -0000 |
vti_cacheddtm:TX|07 Jan 2005 22:10:52 -0000 |
vti_filesize:IR|8996 |
vti_cachedneedsrewrite:BR|false |
vti_cachedhasbots:BR|false |
vti_cachedhastheme:BR|false |
vti_cachedhasborder:BR|false |
vti_charset:SR|windows-1250 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/_vti_cnf/upgrade_1.3.4.php |
---|
0,0 → 1,14 |
vti_encoding:SR|utf8-nl |
vti_timelastmodified:TR|07 Jan 2005 22:10:52 -0000 |
vti_extenderversion:SR|6.0.2.5516 |
vti_author:SR|KAKLIK\\Jakub |
vti_modifiedby:SR|KAKLIK\\Jakub |
vti_timecreated:TR|07 Jan 2005 22:10:52 -0000 |
vti_cacheddtm:TX|07 Jan 2005 22:10:52 -0000 |
vti_filesize:IR|8996 |
vti_cachedneedsrewrite:BR|false |
vti_cachedhasbots:BR|false |
vti_cachedhastheme:BR|false |
vti_cachedhasborder:BR|false |
vti_charset:SR|windows-1250 |
vti_backlinkinfo:VX| |
/web/test/gallery/phpwebgallery/install/config.sql |
---|
0,0 → 1,29 |
-- initial configuration for PhpWebGallery |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('prefix_thumbnail','TN-','thumbnails filename prefix'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('mail_webmaster','','webmaster mail'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_language','en_UK.iso-8859-1','Default gallery language'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_template','default','Default gallery style'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_maxwidth','','maximum width authorized for displaying images'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('default_maxheight','','maximum height authorized for the displaying images'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_comment_page','10','number of comments to display on each page'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxfilesize','150','maximum filesize for the uploaded pictures'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxwidth','800','maximum width authorized for the uploaded images'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxheight','600','maximum height authorized for the uploaded images'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxwidth_thumbnail','150','maximum width authorized for the uploaded thumbnails'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('upload_maxheight_thumbnail','100','maximum height authorized for the uploaded thumbnails'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('log','false','keep an history of visits on your website'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('comments_validation','false','administrators validate users comments before becoming visible'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('comments_forall','false','even guest not registered can post comments'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('mail_notification','false','automated mail notification for adminsitrators'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_image_line','5','Number of images displayed per row'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('nb_line_page','3','Number of rows displayed per page'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('recent_period','7','Period within which pictures are displayed as new (in days)'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('auto_expand','false','Auto expand of the category tree'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_nb_comments','false','Show the number of comments under the thumbnails'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('use_iptc','false','Use IPTC data during database synchronization with files metadata'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('use_exif','false','Use EXIF data during database synchronization with files metadata'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_iptc','false','Show IPTC metadata on picture.php if asked by user'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('show_exif','true','Show EXIF metadata on picture.php if asked by user'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('authorize_remembering','true','Authorize users to be remembered, see $conf{remember_me_length}'); |
INSERT INTO phpwebgallery_config (param,value,comment) VALUES ('gallery_locked','false','Lock your gallery temporary for non admin users'); |
/web/test/gallery/phpwebgallery/install/dbscheme.txt |
---|
0,0 → 1,149 |
table:categories |
table:comments |
table:config |
table:favorites |
table:group_access |
table:groups |
table:history |
table:image_category |
table:images |
table:rate |
table:sessions |
table:sites |
table:user_access |
table:user_forbidden |
table:user_group |
table:users |
table:waiting |
column:id table:categories type:smallint nullable:N length:5 signed:N |
column:date_last table:categories type:date nullable:Y |
column:nb_images table:categories type:mediumint nullable:N length:8 signed:N |
column:name table:categories type:varchar nullable:N length:255 binary:N |
column:id_uppercat table:categories type:smallint nullable:Y length:5 signed:N |
column:comment table:categories type:text nullable:Y |
column:dir table:categories type:varchar nullable:Y length:255 binary:N |
column:rank table:categories type:tinyint nullable:Y length:3 signed:N |
column:status table:categories type:enum('public','private') nullable:N |
column:site_id table:categories type:tinyint nullable:Y length:4 signed:N |
column:visible table:categories type:enum('true','false') nullable:N |
column:uploadable table:categories type:enum('true','false') nullable:N |
column:representative_picture_id table:categories type:mediumint nullable:Y length:8 signed:N |
column:uppercats table:categories type:varchar nullable:N length:255 binary:N |
column:commentable table:categories type:enum('true','false') nullable:N |
column:global_rank table:categories type:varchar nullable:Y length:255 binary:N |
column:id table:comments type:int nullable:N length:11 signed:N |
column:image_id table:comments type:mediumint nullable:N length:8 signed:N |
column:date table:comments type:datetime nullable:N |
column:author table:comments type:varchar nullable:Y length:255 binary:N |
column:content table:comments type:longtext nullable:Y |
column:validated table:comments type:enum('true','false') nullable:N |
column:param table:config type:varchar nullable:N length:40 binary:N |
column:value table:config type:varchar nullable:Y length:255 binary:N |
column:comment table:config type:varchar nullable:Y length:255 binary:N |
column:user_id table:favorites type:smallint nullable:N length:5 signed:N |
column:image_id table:favorites type:mediumint nullable:N length:8 signed:N |
column:group_id table:group_access type:smallint nullable:N length:5 signed:N |
column:cat_id table:group_access type:smallint nullable:N length:5 signed:N |
column:id table:groups type:smallint nullable:N length:5 signed:N |
column:name table:groups type:varchar nullable:N length:255 binary:N |
column:date table:history type:datetime nullable:N |
column:login table:history type:varchar nullable:Y length:15 binary:N |
column:IP table:history type:varchar nullable:N length:50 binary:N |
column:category table:history type:varchar nullable:Y length:150 binary:N |
column:file table:history type:varchar nullable:Y length:50 binary:N |
column:picture table:history type:varchar nullable:Y length:150 binary:N |
column:image_id table:image_category type:mediumint nullable:N length:8 signed:N |
column:category_id table:image_category type:smallint nullable:N length:5 signed:N |
column:id table:images type:mediumint nullable:N length:8 signed:N |
column:file table:images type:varchar nullable:N length:255 binary:N |
column:date_available table:images type:date nullable:N |
column:date_creation table:images type:date nullable:Y |
column:tn_ext table:images type:varchar nullable:Y length:4 binary:N |
column:name table:images type:varchar nullable:Y length:255 binary:N |
column:comment table:images type:text nullable:Y |
column:author table:images type:varchar nullable:Y length:255 binary:N |
column:hit table:images type:int nullable:N length:10 signed:N |
column:filesize table:images type:mediumint nullable:Y length:9 signed:N |
column:width table:images type:smallint nullable:Y length:9 signed:N |
column:height table:images type:smallint nullable:Y length:9 signed:N |
column:keywords table:images type:varchar nullable:Y length:255 binary:N |
column:storage_category_id table:images type:smallint nullable:Y length:5 signed:N |
column:representative_ext table:images type:varchar nullable:Y length:4 binary:N |
column:date_metadata_update table:images type:date nullable:Y |
column:average_rate table:images type:float nullable:Y length:5,2 signed:N |
column:path table:images type:varchar nullable:N length:255 binary:N |
column:user_id table:rate type:smallint nullable:N length:5 signed:N |
column:element_id table:rate type:mediumint nullable:N length:8 signed:N |
column:rate table:rate type:tinyint nullable:N length:2 signed:N |
column:id table:sessions type:varchar nullable:N length:255 binary:Y |
column:user_id table:sessions type:smallint nullable:N length:5 signed:N |
column:expiration table:sessions type:datetime nullable:N |
column:id table:sites type:tinyint nullable:N length:4 signed:Y |
column:galleries_url table:sites type:varchar nullable:N length:255 binary:N |
column:user_id table:user_access type:smallint nullable:N length:5 signed:N |
column:cat_id table:user_access type:smallint nullable:N length:5 signed:N |
column:user_id table:user_forbidden type:smallint nullable:N length:5 signed:N |
column:need_update table:user_forbidden type:enum('true','false') nullable:N |
column:forbidden_categories table:user_forbidden type:text nullable:Y |
column:user_id table:user_group type:smallint nullable:N length:5 signed:N |
column:group_id table:user_group type:smallint nullable:N length:5 signed:N |
column:id table:users type:smallint nullable:N length:5 signed:N |
column:username table:users type:varchar nullable:N length:20 binary:Y |
column:password table:users type:varchar nullable:N length:255 binary:N |
column:mail_address table:users type:varchar nullable:Y length:255 binary:N |
column:nb_image_line table:users type:tinyint nullable:N length:1 signed:N |
column:nb_line_page table:users type:tinyint nullable:N length:3 signed:N |
column:status table:users type:enum('admin','guest') nullable:N |
column:language table:users type:varchar nullable:N length:50 binary:N |
column:maxwidth table:users type:smallint nullable:Y length:6 signed:Y |
column:maxheight table:users type:smallint nullable:Y length:6 signed:Y |
column:expand table:users type:enum('true','false') nullable:N |
column:show_nb_comments table:users type:enum('true','false') nullable:N |
column:recent_period table:users type:tinyint nullable:N length:3 signed:N |
column:template table:users type:varchar nullable:N length:255 binary:N |
column:id table:waiting type:int nullable:N length:10 signed:N |
column:storage_category_id table:waiting type:smallint nullable:N length:5 signed:N |
column:file table:waiting type:varchar nullable:N length:255 binary:N |
column:username table:waiting type:varchar nullable:N length:255 binary:N |
column:mail_address table:waiting type:varchar nullable:N length:255 binary:N |
column:date table:waiting type:int nullable:N length:10 signed:N |
column:tn_ext table:waiting type:char nullable:Y length:3 binary:N |
column:validated table:waiting type:enum('true','false') nullable:N |
column:infos table:waiting type:text nullable:Y |
PK:categories_pk table:categories column:id |
PK:comments_pk table:comments column:id |
PK:config_pk table:config column:param |
PK:favorites_pk table:favorites column:user_id |
PK:favorites_pk table:favorites column:image_id |
PK:group_access_pk table:group_access column:group_id |
PK:group_access_pk table:group_access column:cat_id |
PK:groups_pk table:groups column:id |
PK:image_category_pk table:image_category column:image_id |
PK:image_category_pk table:image_category column:category_id |
PK:images_pk table:images column:id |
PK:rate_pk table:rate column:user_id |
PK:rate_pk table:rate column:element_id |
PK:sessions_pk table:sessions column:id |
PK:sites_pk table:sites column:id |
PK:user_access_pk table:user_access column:user_id |
PK:user_access_pk table:user_access column:cat_id |
PK:user_forbidden_pk table:user_forbidden column:user_id |
PK:user_group_pk table:user_group column:group_id |
PK:user_group_pk table:user_group column:user_id |
PK:users_pk table:users column:id |
PK:waiting_pk table:waiting column:id |
index:categories_i2 table:categories column:id_uppercat |
index:history_i1 table:history column:date |
index:image_category_i1 table:image_category column:image_id |
index:image_category_i2 table:image_category column:category_id |
index:images_i2 table:images column:date_available |
index:images_i1 table:images column:storage_category_id |
index:images_i3 table:images column:average_rate |
index:images_i4 table:images column:hit |
index:images_i5 table:images column:date_creation |
index:sites_ui1 table:sites column:galleries_url |
index:users_ui1 table:users column:username |
/web/test/gallery/phpwebgallery/install/phpwebgallery_structure.sql |
---|
0,0 → 1,264 |
-- MySQL dump 8.21 |
-- |
-- Host: localhost Database: pwg-bsf |
--------------------------------------------------------- |
-- Server version 3.23.49-log |
-- |
-- Table structure for table 'phpwebgallery_categories' |
-- |
DROP TABLE IF EXISTS phpwebgallery_categories; |
CREATE TABLE phpwebgallery_categories ( |
id smallint(5) unsigned NOT NULL auto_increment, |
date_last date default NULL, |
nb_images mediumint(8) unsigned NOT NULL default '0', |
name varchar(255) NOT NULL default '', |
id_uppercat smallint(5) unsigned default NULL, |
comment text, |
dir varchar(255) default NULL, |
rank tinyint(3) unsigned default NULL, |
status enum('public','private') NOT NULL default 'public', |
site_id tinyint(4) unsigned default '1', |
visible enum('true','false') NOT NULL default 'true', |
uploadable enum('true','false') NOT NULL default 'false', |
representative_picture_id mediumint(8) unsigned default NULL, |
uppercats varchar(255) NOT NULL default '', |
commentable enum('true','false') NOT NULL default 'true', |
global_rank varchar(255) default NULL, |
PRIMARY KEY (id), |
KEY categories_i2 (id_uppercat) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_comments' |
-- |
DROP TABLE IF EXISTS phpwebgallery_comments; |
CREATE TABLE phpwebgallery_comments ( |
id int(11) unsigned NOT NULL auto_increment, |
image_id mediumint(8) unsigned NOT NULL default '0', |
date datetime NOT NULL default '0000-00-00 00:00:00', |
author varchar(255) default NULL, |
content longtext, |
validated enum('true','false') NOT NULL default 'false', |
PRIMARY KEY (id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_config' |
-- |
DROP TABLE IF EXISTS phpwebgallery_config; |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table'; |
-- |
-- Table structure for table 'phpwebgallery_favorites' |
-- |
DROP TABLE IF EXISTS phpwebgallery_favorites; |
CREATE TABLE phpwebgallery_favorites ( |
user_id smallint(5) unsigned NOT NULL default '0', |
image_id mediumint(8) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,image_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_group_access' |
-- |
DROP TABLE IF EXISTS phpwebgallery_group_access; |
CREATE TABLE phpwebgallery_group_access ( |
group_id smallint(5) unsigned NOT NULL default '0', |
cat_id smallint(5) unsigned NOT NULL default '0', |
PRIMARY KEY (group_id,cat_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_groups' |
-- |
DROP TABLE IF EXISTS phpwebgallery_groups; |
CREATE TABLE phpwebgallery_groups ( |
id smallint(5) unsigned NOT NULL auto_increment, |
name varchar(255) NOT NULL default '', |
PRIMARY KEY (id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_history' |
-- |
DROP TABLE IF EXISTS phpwebgallery_history; |
CREATE TABLE phpwebgallery_history ( |
date datetime NOT NULL default '0000-00-00 00:00:00', |
login varchar(15) default NULL, |
IP varchar(50) NOT NULL default '', |
category varchar(150) default NULL, |
file varchar(50) default NULL, |
picture varchar(150) default NULL, |
KEY history_i1 (date) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_image_category' |
-- |
DROP TABLE IF EXISTS phpwebgallery_image_category; |
CREATE TABLE phpwebgallery_image_category ( |
image_id mediumint(8) unsigned NOT NULL default '0', |
category_id smallint(5) unsigned NOT NULL default '0', |
PRIMARY KEY (image_id,category_id), |
KEY image_category_i1 (image_id), |
KEY image_category_i2 (category_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_images' |
-- |
DROP TABLE IF EXISTS phpwebgallery_images; |
CREATE TABLE phpwebgallery_images ( |
id mediumint(8) unsigned NOT NULL auto_increment, |
file varchar(255) NOT NULL default '', |
date_available date NOT NULL default '0000-00-00', |
date_creation date default NULL, |
tn_ext varchar(4) default '', |
name varchar(255) default NULL, |
comment text, |
author varchar(255) default NULL, |
hit int(10) unsigned NOT NULL default '0', |
filesize mediumint(9) unsigned default NULL, |
width smallint(9) unsigned default NULL, |
height smallint(9) unsigned default NULL, |
keywords varchar(255) default NULL, |
storage_category_id smallint(5) unsigned default NULL, |
representative_ext varchar(4) default NULL, |
date_metadata_update date default NULL, |
average_rate float(5,2) unsigned default NULL, |
path varchar(255) NOT NULL default '', |
PRIMARY KEY (id), |
KEY images_i2 (date_available), |
KEY images_i1 (storage_category_id), |
KEY images_i3 (average_rate), |
KEY images_i4 (hit), |
KEY images_i5 (date_creation) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_rate' |
-- |
DROP TABLE IF EXISTS phpwebgallery_rate; |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_sessions' |
-- |
DROP TABLE IF EXISTS phpwebgallery_sessions; |
CREATE TABLE phpwebgallery_sessions ( |
id varchar(255) binary NOT NULL default '', |
user_id smallint(5) unsigned NOT NULL default '0', |
expiration datetime NOT NULL default '0000-00-00 00:00:00', |
PRIMARY KEY (id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_sites' |
-- |
DROP TABLE IF EXISTS phpwebgallery_sites; |
CREATE TABLE phpwebgallery_sites ( |
id tinyint(4) NOT NULL auto_increment, |
galleries_url varchar(255) NOT NULL default '', |
PRIMARY KEY (id), |
UNIQUE KEY sites_ui1 (galleries_url) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_user_access' |
-- |
DROP TABLE IF EXISTS phpwebgallery_user_access; |
CREATE TABLE phpwebgallery_user_access ( |
user_id smallint(5) unsigned NOT NULL default '0', |
cat_id smallint(5) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,cat_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_user_forbidden' |
-- |
DROP TABLE IF EXISTS phpwebgallery_user_forbidden; |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_user_group' |
-- |
DROP TABLE IF EXISTS phpwebgallery_user_group; |
CREATE TABLE phpwebgallery_user_group ( |
user_id smallint(5) unsigned NOT NULL default '0', |
group_id smallint(5) unsigned NOT NULL default '0', |
PRIMARY KEY (group_id,user_id) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_users' |
-- |
DROP TABLE IF EXISTS phpwebgallery_users; |
CREATE TABLE phpwebgallery_users ( |
id smallint(5) unsigned NOT NULL auto_increment, |
username varchar(20) binary NOT NULL default '', |
password varchar(255) NOT NULL default '', |
mail_address varchar(255) default NULL, |
nb_image_line tinyint(1) unsigned NOT NULL default '5', |
nb_line_page tinyint(3) unsigned NOT NULL default '3', |
status enum('admin','guest') NOT NULL default 'guest', |
language varchar(50) NOT NULL default 'english', |
maxwidth smallint(6) default NULL, |
maxheight smallint(6) default NULL, |
expand enum('true','false') NOT NULL default 'false', |
show_nb_comments enum('true','false') NOT NULL default 'false', |
recent_period tinyint(3) unsigned NOT NULL default '7', |
template varchar(255) NOT NULL default 'default', |
PRIMARY KEY (id), |
UNIQUE KEY users_ui1 (username) |
) TYPE=MyISAM; |
-- |
-- Table structure for table 'phpwebgallery_waiting' |
-- |
DROP TABLE IF EXISTS phpwebgallery_waiting; |
CREATE TABLE phpwebgallery_waiting ( |
id int(10) unsigned NOT NULL auto_increment, |
storage_category_id smallint(5) unsigned NOT NULL default '0', |
file varchar(255) NOT NULL default '', |
username varchar(255) NOT NULL default '', |
mail_address varchar(255) NOT NULL default '', |
date int(10) unsigned NOT NULL default '0', |
tn_ext char(3) default NULL, |
validated enum('true','false') NOT NULL default 'false', |
infos text, |
PRIMARY KEY (id) |
) TYPE=MyISAM; |
/web/test/gallery/phpwebgallery/install/upgrade_1.3.0.php |
---|
0,0 → 1,401 |
<?php |
// +-----------------------------------------------------------------------+ |
// | PhpWebGallery - a PHP based picture gallery | |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
// +-----------------------------------------------------------------------+ |
// | branch : BSF (Best So Far) |
// | file : $RCSfile: upgrade_1.3.0.php,v $ |
// | last update : $Date: 2005/01/07 23:10:51 $ |
// | last modifier : $Author: plg $ |
// | revision : $Revision: 1.2 $ |
// +-----------------------------------------------------------------------+ |
// | 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('IN_UPGRADE') or !IN_UPGRADE) |
{ |
die('Hacking attempt!'); |
} |
$last_time = get_moment(); |
// save data before deletion |
$query = ' |
SELECT prefix_thumbnail, mail_webmaster |
FROM '.PREFIX_TABLE.'config |
;'; |
$save = mysql_fetch_array(mysql_query($query)); |
$queries = array( |
" |
DROP TABLE phpwebgallery_config |
;", |
" |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table' |
;", |
" |
ALTER TABLE phpwebgallery_categories |
CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1', |
ADD COLUMN commentable enum('true','false') NOT NULL default 'true', |
ADD COLUMN uppercats varchar(255) NOT NULL default '', |
ADD COLUMN global_rank varchar(255) default NULL, |
ADD INDEX categories_i2 (id_uppercat) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_comments |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_comments |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_comments |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_favorites |
DROP INDEX user_id, |
ADD PRIMARY KEY (user_id,image_id) |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_history |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_history |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_history |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_history |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD INDEX history_i1 (date) |
;", |
" |
ALTER TABLE phpwebgallery_image_category |
ADD INDEX image_category_i1 (image_id), |
ADD INDEX image_category_i2 (category_id) |
;", |
" |
ALTER TABLE phpwebgallery_images |
CHANGE COLUMN tn_ext tn_ext varchar(4) default '', |
ADD COLUMN path varchar(255) NOT NULL default '', |
ADD COLUMN date_metadata_update date default NULL, |
ADD COLUMN average_rate float(5,2) unsigned default NULL, |
ADD COLUMN representative_ext varchar(4) default NULL, |
DROP INDEX storage_category_id, |
ADD INDEX images_i1 (storage_category_id), |
ADD INDEX images_i2 (date_available), |
ADD INDEX images_i3 (average_rate), |
ADD INDEX images_i4 (hit), |
ADD INDEX images_i5 (date_creation) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN ip |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
ADD COLUMN expiration_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration_temp = expiration |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration = FROM_UNIXTIME(expiration_temp) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN expiration_temp |
;", |
" |
ALTER TABLE phpwebgallery_sites |
DROP INDEX galleries_url, |
ADD UNIQUE sites_ui1 (galleries_url) |
;", |
" |
ALTER TABLE phpwebgallery_users |
DROP COLUMN long_period, |
DROP COLUMN short_period, |
ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7', |
DROP INDEX username, |
ADD UNIQUE users_ui1 (username) |
;", |
" |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM |
;", |
" |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM |
;", |
" |
UPDATE phpwebgallery_users |
SET language = 'en_UK.iso-8859-1' |
, template = 'default' |
;", |
" |
DELETE FROM phpwebgallery_user_access |
;", |
" |
DELETE FROM phpwebgallery_group_access |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Basic database structure upgrade done</pre>'; |
flush(); |
$last_time = $new_time; |
execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', |
'phpwebgallery_', |
PREFIX_TABLE); |
$queries = array( |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['prefix_thumbnail']."' |
WHERE param = 'prefix_thumbnail' |
;", |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['mail_webmaster']."' |
WHERE param = 'mail_webmaster' |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Saved configuration information restored</pre>'; |
flush(); |
$last_time = $new_time; |
// filling the new column categories.uppercats |
$id_uppercats = array(); |
$query = ' |
SELECT id, id_uppercat |
FROM '.CATEGORIES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
if (!isset($row['id_uppercat']) or $row['id_uppercat'] == '') |
{ |
$row['id_uppercat'] = 'NULL'; |
} |
$id_uppercats[$row['id']] = $row['id_uppercat']; |
} |
$datas = array(); |
foreach (array_keys($id_uppercats) as $id) |
{ |
$data = array(); |
$data['id'] = $id; |
$uppercats = array(); |
array_push($uppercats, $id); |
while (isset($id_uppercats[$id]) and $id_uppercats[$id] != 'NULL') |
{ |
array_push($uppercats, $id_uppercats[$id]); |
$id = $id_uppercats[$id]; |
} |
$data['uppercats'] = implode(',', array_reverse($uppercats)); |
array_push($datas, $data); |
} |
$fields = array('primary' => array('id'), 'update' => array('uppercats')); |
mass_updates(CATEGORIES_TABLE, $fields, $datas); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' filling the new column categories.uppercats</pre>'; |
flush(); |
$last_time = $new_time; |
// refresh calculated datas |
ordering(); |
update_global_rank(); |
update_category(); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Calculated data updated (categories.rank, categories.global_rank, |
categories.date_last, categories.representative_picture_id, |
categories.nb_images)</pre>'; |
flush(); |
$last_time = $new_time; |
// update calculated field "images.path" |
$cat_ids = array(); |
$query = ' |
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id |
FROM '.IMAGES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['unique_storage_category_id']); |
} |
$fulldirs = get_fulldirs($cat_ids); |
foreach ($cat_ids as $cat_id) |
{ |
$query = ' |
UPDATE '.IMAGES_TABLE.' |
SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) |
WHERE storage_category_id = '.$cat_id.' |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' new column images.path filled</pre>'; |
flush(); |
$last_time = $new_time; |
// all sub-categories of private categories become private |
$cat_ids = array(); |
$query = ' |
SELECT id |
FROM '.CATEGORIES_TABLE.' |
WHERE status = \'private\' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['id']); |
} |
if (count($cat_ids) > 0) |
{ |
$privates = get_subcat_ids($cat_ids); |
$query = ' |
UPDATE '.CATEGORIES_TABLE.' |
SET status = \'private\' |
WHERE id IN ('.implode(',', $privates).') |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' all sub-categories of private categories become private</pre>'; |
flush(); |
$last_time = $new_time; |
$infos = array( |
'user permissions and group permissions have been erased', |
'only thumbnails prefix and webmaster mail address have been saved from |
previous configuration', |
'in include/mysql.inc.php, before |
<pre style="background-color:lightgray">?></pre> |
insert |
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>' |
); |
?> |
/web/test/gallery/phpwebgallery/install/upgrade_1.3.1.php |
---|
0,0 → 1,363 |
<?php |
// +-----------------------------------------------------------------------+ |
// | PhpWebGallery - a PHP based picture gallery | |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
// +-----------------------------------------------------------------------+ |
// | branch : BSF (Best So Far) |
// | file : $RCSfile: upgrade_1.3.1.php,v $ |
// | last update : $Date: 2005/01/07 23:10:51 $ |
// | last modifier : $Author: plg $ |
// | revision : $Revision: 1.2 $ |
// +-----------------------------------------------------------------------+ |
// | 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('IN_UPGRADE') or !IN_UPGRADE) |
{ |
die('Hacking attempt!'); |
} |
$last_time = get_moment(); |
// save data before deletion |
$query = ' |
SELECT prefix_thumbnail, mail_webmaster |
FROM '.PREFIX_TABLE.'config |
;'; |
$save = mysql_fetch_array(mysql_query($query)); |
$queries = array( |
" |
DROP TABLE phpwebgallery_config |
;", |
" |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table' |
;", |
" |
ALTER TABLE phpwebgallery_categories |
CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1', |
ADD COLUMN commentable enum('true','false') NOT NULL default 'true', |
ADD COLUMN global_rank varchar(255) default NULL, |
DROP INDEX id, |
DROP INDEX id_uppercat, |
ADD INDEX categories_i2 (id_uppercat) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_comments |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_comments |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_comments |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_favorites |
DROP INDEX user_id, |
ADD PRIMARY KEY (user_id,image_id) |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_history |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_history |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_history |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_history |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD INDEX history_i1 (date) |
;", |
" |
ALTER TABLE phpwebgallery_image_category |
DROP INDEX image_id, |
DROP INDEX category_id, |
ADD INDEX image_category_i1 (image_id), |
ADD INDEX image_category_i2 (category_id) |
;", |
" |
ALTER TABLE phpwebgallery_images |
CHANGE COLUMN tn_ext tn_ext varchar(4) default '', |
ADD COLUMN path varchar(255) NOT NULL default '', |
ADD COLUMN date_metadata_update date default NULL, |
ADD COLUMN average_rate float(5,2) unsigned default NULL, |
ADD COLUMN representative_ext varchar(4) default NULL, |
DROP INDEX storage_category_id, |
ADD INDEX images_i1 (storage_category_id), |
ADD INDEX images_i2 (date_available), |
ADD INDEX images_i3 (average_rate), |
ADD INDEX images_i4 (hit), |
ADD INDEX images_i5 (date_creation) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN ip |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
ADD COLUMN expiration_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration_temp = expiration |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration = FROM_UNIXTIME(expiration_temp) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN expiration_temp |
;", |
" |
ALTER TABLE phpwebgallery_sites |
DROP INDEX galleries_url, |
ADD UNIQUE sites_ui1 (galleries_url) |
;", |
" |
DROP TABLE phpwebgallery_user_category |
;", |
" |
ALTER TABLE phpwebgallery_users |
DROP COLUMN long_period, |
DROP COLUMN short_period, |
DROP COLUMN forbidden_categories, |
ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7', |
DROP INDEX username, |
ADD UNIQUE users_ui1 (username) |
;", |
" |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM |
;", |
" |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM |
;", |
" |
UPDATE phpwebgallery_users |
SET language = 'en_UK.iso-8859-1' |
, template = 'default' |
;", |
" |
DELETE FROM phpwebgallery_user_access |
;", |
" |
DELETE FROM phpwebgallery_group_access |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Basic database structure upgrade done</pre>'; |
flush(); |
$last_time = $new_time; |
execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', |
'phpwebgallery_', |
PREFIX_TABLE); |
$queries = array( |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['prefix_thumbnail']."' |
WHERE param = 'prefix_thumbnail' |
;", |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['mail_webmaster']."' |
WHERE param = 'mail_webmaster' |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Saved configuration information restored</pre>'; |
flush(); |
$last_time = $new_time; |
ordering(); |
update_global_rank(); |
update_category(); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Calculated data updated (categories.rank, categories.global_rank, |
categories.date_last, categories.representative_picture_id, |
categories.nb_images)</pre>'; |
flush(); |
$last_time = $new_time; |
// update calculated field "images.path" |
$cat_ids = array(); |
$query = ' |
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id |
FROM '.IMAGES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['unique_storage_category_id']); |
} |
$fulldirs = get_fulldirs($cat_ids); |
foreach ($cat_ids as $cat_id) |
{ |
$query = ' |
UPDATE '.IMAGES_TABLE.' |
SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) |
WHERE storage_category_id = '.$cat_id.' |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' new column images.path filled</pre>'; |
flush(); |
$last_time = $new_time; |
// all sub-categories of private categories become private |
$cat_ids = array(); |
$query = ' |
SELECT id |
FROM '.CATEGORIES_TABLE.' |
WHERE status = \'private\' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['id']); |
} |
if (count($cat_ids) > 0) |
{ |
$privates = get_subcat_ids($cat_ids); |
$query = ' |
UPDATE '.CATEGORIES_TABLE.' |
SET status = \'private\' |
WHERE id IN ('.implode(',', $privates).') |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' all sub-categories of private categories become private</pre>'; |
flush(); |
$last_time = $new_time; |
$infos = array( |
'user permissions and group permissions have been erased', |
'only thumbnails prefix and webmaster mail address have been saved from |
previous configuration', |
'in include/mysql.inc.php, before |
<pre style="background-color:lightgray">?></pre> |
insert |
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>' |
); |
?> |
/web/test/gallery/phpwebgallery/install/upgrade_1.3.2.php |
---|
0,0 → 1,362 |
<?php |
// +-----------------------------------------------------------------------+ |
// | PhpWebGallery - a PHP based picture gallery | |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
// +-----------------------------------------------------------------------+ |
// | branch : BSF (Best So Far) |
// | file : $RCSfile: upgrade_1.3.2.php,v $ |
// | last update : $Date: 2005/01/07 23:10:51 $ |
// | last modifier : $Author: plg $ |
// | revision : $Revision: 1.2 $ |
// +-----------------------------------------------------------------------+ |
// | 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('IN_UPGRADE') or !IN_UPGRADE) |
{ |
die('Hacking attempt!'); |
} |
$last_time = get_moment(); |
// save data before deletion |
$query = ' |
SELECT prefix_thumbnail, mail_webmaster |
FROM '.PREFIX_TABLE.'config |
;'; |
$save = mysql_fetch_array(mysql_query($query)); |
$queries = array( |
" |
DROP TABLE phpwebgallery_config |
;", |
" |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table' |
;", |
" |
ALTER TABLE phpwebgallery_categories |
CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1', |
ADD COLUMN commentable enum('true','false') NOT NULL default 'true', |
ADD COLUMN global_rank varchar(255) default NULL, |
DROP INDEX id_uppercat, |
ADD INDEX categories_i2 (id_uppercat) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_comments |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_comments |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_comments |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_favorites |
DROP INDEX user_id, |
ADD PRIMARY KEY (user_id,image_id) |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_history |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_history |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_history |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_history |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD INDEX history_i1 (date) |
;", |
" |
ALTER TABLE phpwebgallery_image_category |
DROP INDEX image_id, |
DROP INDEX category_id, |
ADD INDEX image_category_i1 (image_id), |
ADD INDEX image_category_i2 (category_id) |
;", |
" |
ALTER TABLE phpwebgallery_images |
CHANGE COLUMN tn_ext tn_ext varchar(4) default '', |
ADD COLUMN path varchar(255) NOT NULL default '', |
ADD COLUMN date_metadata_update date default NULL, |
ADD COLUMN average_rate float(5,2) unsigned default NULL, |
ADD COLUMN representative_ext varchar(4) default NULL, |
DROP INDEX storage_category_id, |
ADD INDEX images_i1 (storage_category_id), |
ADD INDEX images_i2 (date_available), |
ADD INDEX images_i3 (average_rate), |
ADD INDEX images_i4 (hit), |
ADD INDEX images_i5 (date_creation) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN ip |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
ADD COLUMN expiration_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration_temp = expiration |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration = FROM_UNIXTIME(expiration_temp) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN expiration_temp |
;", |
" |
ALTER TABLE phpwebgallery_sites |
DROP INDEX galleries_url, |
ADD UNIQUE sites_ui1 (galleries_url) |
;", |
" |
DROP TABLE phpwebgallery_user_category |
;", |
" |
ALTER TABLE phpwebgallery_users |
DROP COLUMN long_period, |
DROP COLUMN short_period, |
DROP COLUMN forbidden_categories, |
ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7', |
DROP INDEX username, |
ADD UNIQUE users_ui1 (username) |
;", |
" |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM |
;", |
" |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM |
;", |
" |
UPDATE phpwebgallery_users |
SET language = 'en_UK.iso-8859-1' |
, template = 'default' |
;", |
" |
DELETE FROM phpwebgallery_user_access |
;", |
" |
DELETE FROM phpwebgallery_group_access |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Basic database structure upgrade done</pre>'; |
flush(); |
$last_time = $new_time; |
execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', |
'phpwebgallery_', |
PREFIX_TABLE); |
$queries = array( |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['prefix_thumbnail']."' |
WHERE param = 'prefix_thumbnail' |
;", |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['mail_webmaster']."' |
WHERE param = 'mail_webmaster' |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Saved configuration information restored</pre>'; |
flush(); |
$last_time = $new_time; |
ordering(); |
update_global_rank(); |
update_category(); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Calculated data updated (categories.rank, categories.global_rank, |
categories.date_last, categories.representative_picture_id, |
categories.nb_images)</pre>'; |
flush(); |
$last_time = $new_time; |
// update calculated field "images.path" |
$cat_ids = array(); |
$query = ' |
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id |
FROM '.IMAGES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['unique_storage_category_id']); |
} |
$fulldirs = get_fulldirs($cat_ids); |
foreach ($cat_ids as $cat_id) |
{ |
$query = ' |
UPDATE '.IMAGES_TABLE.' |
SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) |
WHERE storage_category_id = '.$cat_id.' |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' new column images.path filled</pre>'; |
flush(); |
$last_time = $new_time; |
// all sub-categories of private categories become private |
$cat_ids = array(); |
$query = ' |
SELECT id |
FROM '.CATEGORIES_TABLE.' |
WHERE status = \'private\' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['id']); |
} |
if (count($cat_ids) > 0) |
{ |
$privates = get_subcat_ids($cat_ids); |
$query = ' |
UPDATE '.CATEGORIES_TABLE.' |
SET status = \'private\' |
WHERE id IN ('.implode(',', $privates).') |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' all sub-categories of private categories become private</pre>'; |
flush(); |
$last_time = $new_time; |
$infos = array( |
'user permissions and group permissions have been erased', |
'only thumbnails prefix and webmaster mail address have been saved from |
previous configuration', |
'in include/mysql.inc.php, before |
<pre style="background-color:lightgray">?></pre> |
insert |
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>' |
); |
?> |
/web/test/gallery/phpwebgallery/install/upgrade_1.3.3.php |
---|
0,0 → 1,362 |
<?php |
// +-----------------------------------------------------------------------+ |
// | PhpWebGallery - a PHP based picture gallery | |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
// +-----------------------------------------------------------------------+ |
// | branch : BSF (Best So Far) |
// | file : $RCSfile: upgrade_1.3.3.php,v $ |
// | last update : $Date: 2005/01/07 23:10:51 $ |
// | last modifier : $Author: plg $ |
// | revision : $Revision: 1.2 $ |
// +-----------------------------------------------------------------------+ |
// | 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('IN_UPGRADE') or !IN_UPGRADE) |
{ |
die('Hacking attempt!'); |
} |
$last_time = get_moment(); |
// save data before deletion |
$query = ' |
SELECT prefix_thumbnail, mail_webmaster |
FROM '.PREFIX_TABLE.'config |
;'; |
$save = mysql_fetch_array(mysql_query($query)); |
$queries = array( |
" |
DROP TABLE phpwebgallery_config |
;", |
" |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table' |
;", |
" |
ALTER TABLE phpwebgallery_categories |
CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1', |
ADD COLUMN commentable enum('true','false') NOT NULL default 'true', |
ADD COLUMN global_rank varchar(255) default NULL, |
DROP INDEX id_uppercat, |
ADD INDEX categories_i2 (id_uppercat) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_comments |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_comments |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_comments |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_favorites |
DROP INDEX user_id, |
ADD PRIMARY KEY (user_id,image_id) |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_history |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_history |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_history |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_history |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD INDEX history_i1 (date) |
;", |
" |
ALTER TABLE phpwebgallery_image_category |
DROP INDEX image_id, |
DROP INDEX category_id, |
ADD INDEX image_category_i1 (image_id), |
ADD INDEX image_category_i2 (category_id) |
;", |
" |
ALTER TABLE phpwebgallery_images |
CHANGE COLUMN tn_ext tn_ext varchar(4) default '', |
ADD COLUMN path varchar(255) NOT NULL default '', |
ADD COLUMN date_metadata_update date default NULL, |
ADD COLUMN average_rate float(5,2) unsigned default NULL, |
ADD COLUMN representative_ext varchar(4) default NULL, |
DROP INDEX storage_category_id, |
ADD INDEX images_i1 (storage_category_id), |
ADD INDEX images_i2 (date_available), |
ADD INDEX images_i3 (average_rate), |
ADD INDEX images_i4 (hit), |
ADD INDEX images_i5 (date_creation) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN ip |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
ADD COLUMN expiration_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration_temp = expiration |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration = FROM_UNIXTIME(expiration_temp) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN expiration_temp |
;", |
" |
ALTER TABLE phpwebgallery_sites |
DROP INDEX galleries_url, |
ADD UNIQUE sites_ui1 (galleries_url) |
;", |
" |
DROP TABLE phpwebgallery_user_category |
;", |
" |
ALTER TABLE phpwebgallery_users |
DROP COLUMN long_period, |
DROP COLUMN short_period, |
DROP COLUMN forbidden_categories, |
ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7', |
DROP INDEX username, |
ADD UNIQUE users_ui1 (username) |
;", |
" |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM |
;", |
" |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM |
;", |
" |
UPDATE phpwebgallery_users |
SET language = 'en_UK.iso-8859-1' |
, template = 'default' |
;", |
" |
DELETE FROM phpwebgallery_user_access |
;", |
" |
DELETE FROM phpwebgallery_group_access |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Basic database structure upgrade done</pre>'; |
flush(); |
$last_time = $new_time; |
execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', |
'phpwebgallery_', |
PREFIX_TABLE); |
$queries = array( |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['prefix_thumbnail']."' |
WHERE param = 'prefix_thumbnail' |
;", |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['mail_webmaster']."' |
WHERE param = 'mail_webmaster' |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Saved configuration information restored</pre>'; |
flush(); |
$last_time = $new_time; |
ordering(); |
update_global_rank(); |
update_category(); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Calculated data updated (categories.rank, categories.global_rank, |
categories.date_last, categories.representative_picture_id, |
categories.nb_images)</pre>'; |
flush(); |
$last_time = $new_time; |
// update calculated field "images.path" |
$cat_ids = array(); |
$query = ' |
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id |
FROM '.IMAGES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['unique_storage_category_id']); |
} |
$fulldirs = get_fulldirs($cat_ids); |
foreach ($cat_ids as $cat_id) |
{ |
$query = ' |
UPDATE '.IMAGES_TABLE.' |
SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) |
WHERE storage_category_id = '.$cat_id.' |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' new column images.path filled</pre>'; |
flush(); |
$last_time = $new_time; |
// all sub-categories of private categories become private |
$cat_ids = array(); |
$query = ' |
SELECT id |
FROM '.CATEGORIES_TABLE.' |
WHERE status = \'private\' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['id']); |
} |
if (count($cat_ids) > 0) |
{ |
$privates = get_subcat_ids($cat_ids); |
$query = ' |
UPDATE '.CATEGORIES_TABLE.' |
SET status = \'private\' |
WHERE id IN ('.implode(',', $privates).') |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' all sub-categories of private categories become private</pre>'; |
flush(); |
$last_time = $new_time; |
$infos = array( |
'user permissions and group permissions have been erased', |
'only thumbnails prefix and webmaster mail address have been saved from |
previous configuration', |
'in include/mysql.inc.php, before |
<pre style="background-color:lightgray">?></pre> |
insert |
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>' |
); |
?> |
/web/test/gallery/phpwebgallery/install/upgrade_1.3.4.php |
---|
0,0 → 1,362 |
<?php |
// +-----------------------------------------------------------------------+ |
// | PhpWebGallery - a PHP based picture gallery | |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | |
// | Copyright (C) 2003-2005 PhpWebGallery Team - http://phpwebgallery.net | |
// +-----------------------------------------------------------------------+ |
// | branch : BSF (Best So Far) |
// | file : $RCSfile: upgrade_1.3.4.php,v $ |
// | last update : $Date: 2005/01/07 23:10:51 $ |
// | last modifier : $Author: plg $ |
// | revision : $Revision: 1.2 $ |
// +-----------------------------------------------------------------------+ |
// | 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('IN_UPGRADE') or !IN_UPGRADE) |
{ |
die('Hacking attempt!'); |
} |
$last_time = get_moment(); |
// save data before deletion |
$query = ' |
SELECT prefix_thumbnail, mail_webmaster |
FROM '.PREFIX_TABLE.'config |
;'; |
$save = mysql_fetch_array(mysql_query($query)); |
$queries = array( |
" |
DROP TABLE phpwebgallery_config |
;", |
" |
CREATE TABLE phpwebgallery_config ( |
param varchar(40) NOT NULL default '', |
value varchar(255) default NULL, |
comment varchar(255) default NULL, |
PRIMARY KEY (param) |
) TYPE=MyISAM COMMENT='configuration table' |
;", |
" |
ALTER TABLE phpwebgallery_categories |
CHANGE COLUMN site_id site_id tinyint(4) unsigned default '1', |
ADD COLUMN commentable enum('true','false') NOT NULL default 'true', |
ADD COLUMN global_rank varchar(255) default NULL, |
DROP INDEX id_uppercat, |
ADD INDEX categories_i2 (id_uppercat) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_comments |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_comments |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_comments |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_comments |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_favorites |
DROP INDEX user_id, |
ADD PRIMARY KEY (user_id,image_id) |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD COLUMN date_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_history |
SET date_temp = date |
;", |
" |
ALTER TABLE phpwebgallery_history |
CHANGE COLUMN date date datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_history |
SET date = FROM_UNIXTIME(date_temp) |
;", |
" |
ALTER TABLE phpwebgallery_history |
DROP COLUMN date_temp |
;", |
" |
ALTER TABLE phpwebgallery_history |
ADD INDEX history_i1 (date) |
;", |
" |
ALTER TABLE phpwebgallery_image_category |
DROP INDEX image_id, |
DROP INDEX category_id, |
ADD INDEX image_category_i1 (image_id), |
ADD INDEX image_category_i2 (category_id) |
;", |
" |
ALTER TABLE phpwebgallery_images |
CHANGE COLUMN tn_ext tn_ext varchar(4) default '', |
ADD COLUMN path varchar(255) NOT NULL default '', |
ADD COLUMN date_metadata_update date default NULL, |
ADD COLUMN average_rate float(5,2) unsigned default NULL, |
ADD COLUMN representative_ext varchar(4) default NULL, |
DROP INDEX storage_category_id, |
ADD INDEX images_i1 (storage_category_id), |
ADD INDEX images_i2 (date_available), |
ADD INDEX images_i3 (average_rate), |
ADD INDEX images_i4 (hit), |
ADD INDEX images_i5 (date_creation) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN ip |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
ADD COLUMN expiration_temp int(11) unsigned |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration_temp = expiration |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
CHANGE COLUMN expiration expiration datetime NOT NULL default '0000-00-00 00:00:00' |
;", |
" |
UPDATE phpwebgallery_sessions |
SET expiration = FROM_UNIXTIME(expiration_temp) |
;", |
" |
ALTER TABLE phpwebgallery_sessions |
DROP COLUMN expiration_temp |
;", |
" |
ALTER TABLE phpwebgallery_sites |
DROP INDEX galleries_url, |
ADD UNIQUE sites_ui1 (galleries_url) |
;", |
" |
DROP TABLE phpwebgallery_user_category |
;", |
" |
ALTER TABLE phpwebgallery_users |
DROP COLUMN long_period, |
DROP COLUMN short_period, |
DROP COLUMN forbidden_categories, |
ADD COLUMN recent_period tinyint(3) unsigned NOT NULL default '7', |
DROP INDEX username, |
ADD UNIQUE users_ui1 (username) |
;", |
" |
CREATE TABLE phpwebgallery_rate ( |
user_id smallint(5) unsigned NOT NULL default '0', |
element_id mediumint(8) unsigned NOT NULL default '0', |
rate tinyint(2) unsigned NOT NULL default '0', |
PRIMARY KEY (user_id,element_id) |
) TYPE=MyISAM |
;", |
" |
CREATE TABLE phpwebgallery_user_forbidden ( |
user_id smallint(5) unsigned NOT NULL default '0', |
need_update enum('true','false') NOT NULL default 'true', |
forbidden_categories text, |
PRIMARY KEY (user_id) |
) TYPE=MyISAM |
;", |
" |
UPDATE phpwebgallery_users |
SET language = 'en_UK.iso-8859-1' |
, template = 'default' |
;", |
" |
DELETE FROM phpwebgallery_user_access |
;", |
" |
DELETE FROM phpwebgallery_group_access |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Basic database structure upgrade done</pre>'; |
flush(); |
$last_time = $new_time; |
execute_sqlfile(PHPWG_ROOT_PATH.'install/config.sql', |
'phpwebgallery_', |
PREFIX_TABLE); |
$queries = array( |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['prefix_thumbnail']."' |
WHERE param = 'prefix_thumbnail' |
;", |
" |
UPDATE phpwebgallery_config |
SET value = '".$save['mail_webmaster']."' |
WHERE param = 'mail_webmaster' |
;" |
); |
foreach ($queries as $query) |
{ |
$query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Saved configuration information restored</pre>'; |
flush(); |
$last_time = $new_time; |
ordering(); |
update_global_rank(); |
update_category(); |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' Calculated data updated (categories.rank, categories.global_rank, |
categories.date_last, categories.representative_picture_id, |
categories.nb_images)</pre>'; |
flush(); |
$last_time = $new_time; |
// update calculated field "images.path" |
$cat_ids = array(); |
$query = ' |
SELECT DISTINCT(storage_category_id) AS unique_storage_category_id |
FROM '.IMAGES_TABLE.' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['unique_storage_category_id']); |
} |
$fulldirs = get_fulldirs($cat_ids); |
foreach ($cat_ids as $cat_id) |
{ |
$query = ' |
UPDATE '.IMAGES_TABLE.' |
SET path = CONCAT(\''.$fulldirs[$cat_id].'\',\'/\',file) |
WHERE storage_category_id = '.$cat_id.' |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' new column images.path filled</pre>'; |
flush(); |
$last_time = $new_time; |
// all sub-categories of private categories become private |
$cat_ids = array(); |
$query = ' |
SELECT id |
FROM '.CATEGORIES_TABLE.' |
WHERE status = \'private\' |
;'; |
$result = pwg_query($query); |
while ($row = mysql_fetch_array($result)) |
{ |
array_push($cat_ids, $row['id']); |
} |
if (count($cat_ids) > 0) |
{ |
$privates = get_subcat_ids($cat_ids); |
$query = ' |
UPDATE '.CATEGORIES_TABLE.' |
SET status = \'private\' |
WHERE id IN ('.implode(',', $privates).') |
;'; |
pwg_query($query); |
} |
$new_time = get_moment(); |
echo '<pre>['.get_elapsed_time($last_time, $new_time).']'; |
echo ' all sub-categories of private categories become private</pre>'; |
flush(); |
$last_time = $new_time; |
$infos = array( |
'user permissions and group permissions have been erased', |
'only thumbnails prefix and webmaster mail address have been saved from |
previous configuration', |
'in include/mysql.inc.php, before |
<pre style="background-color:lightgray">?></pre> |
insert |
<pre style="background-color:lightgray">define(\'PHPWG_INSTALLED\', true);<pre>' |
); |
?> |