diff options
Diffstat (limited to '')
-rw-r--r-- | doc/ChangeLog | 13 | ||||
-rw-r--r-- | doc/README_en.txt | 78 | ||||
-rw-r--r-- | doc/README_fr.txt | 89 | ||||
-rw-r--r-- | include/config_default.inc.php | 2 | ||||
-rw-r--r-- | install/dbscheme.txt | 160 | ||||
-rw-r--r-- | install/upgrade_1.3.0.php | 401 | ||||
-rw-r--r-- | install/upgrade_1.3.1.php | 363 | ||||
-rw-r--r-- | install/upgrade_1.3.2.php | 362 | ||||
-rw-r--r-- | install/upgrade_1.3.3.php | 362 | ||||
-rw-r--r-- | install/upgrade_1.3.4.php | 362 | ||||
-rw-r--r-- | install/upgrade_1.4.0.php | 275 | ||||
-rw-r--r-- | install/upgrade_1.4.1.php | 275 | ||||
-rw-r--r-- | template/yoga/picture.tpl | 3 | ||||
-rw-r--r-- | tools/config_local.inc.php | 8 | ||||
-rw-r--r-- | upgrade.php | 27 |
15 files changed, 691 insertions, 2089 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index fd6d22511..d32a5ae36 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,16 @@ +2005-09-20 Pierrick LE GALL + + * update: upgrade from 1.4.0 or 1.4.1. Upgrade from 1.3.x is not + available anymore. + + * update: README files updated for very near branch 1.5 :-) + + * new: file tools/config_local.inc.php as example for optional + include/config_local.inc.php + + * bug fixed: configuration parameter show_picture_name_on_title + was useless + 2005-09-18 Pierrick LE GALL * bug 111 fixed: "Can't add virtual category when cookie diff --git a/doc/README_en.txt b/doc/README_en.txt index 844dc327c..88766f79c 100644 --- a/doc/README_en.txt +++ b/doc/README_en.txt @@ -1,12 +1,12 @@ - PhpWebGallery +============= +PhpWebGallery +============= -official website : http://phpwebgallery.net -documentation : http://doc.phpwebgallery.net -forum : http://forum.phpwebgallery.net +http://phpwebgallery.net -+-----------------------------------------------------------------------------+ -| Installation instructions | -+-----------------------------------------------------------------------------+ + +Installation +============ 1. extract files from the downloaded file (using tar or unzip command, or softwares like 7-zip or winzip) @@ -17,9 +17,8 @@ forum : http://forum.phpwebgallery.net 3. go to the URL http://your.domain/gallery/install.php and follow the instructions of installation -+-----------------------------------------------------------------------------+ -| Upgrade instructions | -+-----------------------------------------------------------------------------+ +Upgrade +======= 1. elements to save : @@ -40,9 +39,8 @@ forum : http://forum.phpwebgallery.net 5. go to the URL http://your.domain/gallery/upgrade.php and follow the instructions -+-----------------------------------------------------------------------------+ -| How to start | -+-----------------------------------------------------------------------------+ +How to start +============ Once installed or upgraded, your gallery is ready to run. Start by displaying the installation directory in your browser : @@ -55,37 +53,49 @@ page will appear : Administration. Enter the administration panel. In the administration panel, take all your time for reading instructions explaining how to use your gallery. -+-----------------------------------------------------------------------------+ -| Newsletter | -+-----------------------------------------------------------------------------+ +Communication +============= + +Newsletter +---------- + +https://gna.org/mail/?group=phpwebgallery It is *highly* recommended to subscribe to PhpWebGallery newsletter. This is extremely low-traffic, but will provide you with announcements of new PhpWebGallery releases and serious bug notification. You will find available mailing lists at this URL : - https://gna.org/mail/?group=phpwebgallery +No spam, no commercial use. + +Freshmeat +--------- + +http://freshmeat.net/projects/phpwebgallery + +Want to stay informed at each release, stable and development +release. Development releases notification are not send in the newsletter. + +Bugtracker +---------- + +http://bugs.phpwebgallery.net -Be sure that the mail address you are going to give for newsletter is -completely unreadable by someone else than PhpWebGallery team and not -present on any web page (a web search engine won't find it). +Bugs and change requests tracking. The best way to have your bug corrected: +it won't be forgotten (as in the forum). -PhpWebGallery also assure you that your mail address will NEVER be used for -something else than PhpWebGallery informations. +Wiki +---- -+-----------------------------------------------------------------------------+ -| Discussion forum | -+-----------------------------------------------------------------------------+ +http://phpwebgallery.net/doc -A forum is available and recommended for any question (installation, bug -reports, new feature requests) : +Wiki documentation: everyone can participate to improve documentation +content. - http://forum.phpwebgallery.net +Message board +------------- -Before asking any question on the forum, do not hesitate to search for -related topics... other users may have found same bugs, had same requests. +http://forum.phpwebgallery.net -PhpWebGallery forum is a place open to every one. Please be always -respectful in this place. Consider also that clear messages (with simple and -direct subjects) are always prefered. It is forbidden (and useless) to say -that your question is "urgent", you won't be answered in priority. +All communications (installation help, technical discussions) that can't be +done in other channels. diff --git a/doc/README_fr.txt b/doc/README_fr.txt index 597180660..4f49f29e9 100644 --- a/doc/README_fr.txt +++ b/doc/README_fr.txt @@ -1,12 +1,11 @@ - PhpWebGallery +============= +PhpWebGallery +============= -site officel : http://phpwebgallery.net -documentation : http://doc.phpwebgallery.net -forum : http://forum.phpwebgallery.net +http://phpwebgallery.net -+-----------------------------------------------------------------------------+ -| installation | -+-----------------------------------------------------------------------------+ +Installation +============ 1. décompresser à l'aide de winzip par exemple (winrar, winace et beaucoup d'autres le permettent également) le fichier téléchargé. @@ -17,9 +16,8 @@ forum : http://forum.phpwebgallery.net 3. se rendre à l'URL http://votre.domaine/galerie/install.php et suivre les instructions -+-----------------------------------------------------------------------------+ -| mise à jour | -+-----------------------------------------------------------------------------+ +Mise à jour +=========== 1. éléments à sauvegarder : @@ -40,9 +38,8 @@ forum : http://forum.phpwebgallery.net 5. se rendre à l'URL http://votre.domaine/galerie/upgrade.php et suivre les instructions -+-----------------------------------------------------------------------------+ -| Comment commencer | -+-----------------------------------------------------------------------------+ +Comment commencer +================= Une fois installée ou mise à jour, votre galerie est prête à fonctionner. Commencez par vous rendre sur le répertoire d'installation dans @@ -57,9 +54,13 @@ Administration. Suivre ce lien :-) Dans la zone d'administration, prenez tout le temps nécessaire pour consulter les instructions, expliquant comment utiliser votre galerie. -+-----------------------------------------------------------------------------+ -| newsletter | -+-----------------------------------------------------------------------------+ +Communication +============= + +Newsletter +---------- + +https://gna.org/mail/?group=phpwebgallery Il est *fortement* recommandé de souscrire à la newsletter de PhpWebGallery. Très peu de mails sont envoyés, mais les informations sont @@ -67,31 +68,45 @@ importantes : nouvelles versions de l'application, notification de bugs importants (relatifs à la sécurité). Vous trouverez les listes de discussions disponibles sur la page suivante : - https://gna.org/mail/?group=phpwebgallery +Pas de spam, pas d'utilisation commerciale. + +Freshmeat +--------- + +http://freshmeat.net/projects/phpwebgallery + +Permet d'être au courant des sorties de toutes les releases, et en +exclusivité les builds de la branche de développement (ce qui n'est pas +prévu sur les mailing lists "announce"). + +Outil de suivi de bogues +------------------------ + +http://bugs.phpwebgallery.net + +Gestion des bugs, mais aussi demande de nouvelles fonctionnalités. Rien de +plus efficace pour qu'un bug soit corrigé : tant qu'il ne l'est pas, la +"fiche" reste là à attendre, on ne l'oublie pas comme un topic sur le +forum. -Etant moi-même très dérangé par le spam (courrier non solicité), je peux -vous assurer que le mail que vous allez donner à l'équipe de PhpWebGallery -est absolument illisible autrement que par nous sur une page avec accès -sécurisé dont l'URL n'est en lien nul part sur le web (donc introuvable par -un moteur de recherche). +Les demandes d'évolutions sont également gérées dans cet outil. Ce n'est pas +forcément idéal car il ne s'agit pas de la même chose, mais le suivi du dev +d'une nouvelle fonctionnalité peut se modéliser de la même façon que le +suivi de la correction d'un bug. -L'équipe de PhpWebGallery vous assure également que JAMAIS l'adresse qui -nous a été confiée ne sera utilisée dans un autre cadre que la newsletter de -PhpWebGallery. +Wiki +---- -+-----------------------------------------------------------------------------+ -| forum de discussion | -+-----------------------------------------------------------------------------+ +http://phpwebgallery.net/doc -Un forum est disponible et recommandé pour toutes vos questions -(installation, rapport de bugs, demandes de nouvelles fonctionnalités) : +Documentation suivant le système du wiki. Chacun peut participer à +l'amélioration de la doc. - http://forum.phpwebgallery.net +Forum de discussion +------------------- -Avant le poser une question, assurez-vous qu'elle n'a pas déjà sa réponse en -effectuant une recherche. +http://forum.phpwebgallery.net -Le forum est ouvert à tous. Merci d'y faire preuve de respect. Rappelez-vous -que les messages clairs (avec un sujet direct et un énoncé du problème -précis) sont toujours préférés. Il est interdit (et surtout inutile) de dire -que votre question est "urgente", on ne vous répondra pas en priorité. +Un forum est disponible et recommandé pour toutes les questions autres que +les demandes d'évolution et rapport de bogue (installation, discussions +techniques). diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 8d4309dfc..7fe04184d 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -34,7 +34,7 @@ * * It is recommended to let config_default.inc.php as provided and to * overwrite configuration in your local configuration file - * config_local.inc.php + * config_local.inc.php. See tools/config_local.inc.php as an example. * * Why having some parameters in config table and others in * config_*.inc.php? Modifying config_*.inc.php is a "hard" task for low diff --git a/install/dbscheme.txt b/install/dbscheme.txt deleted file mode 100644 index 002059c4d..000000000 --- a/install/dbscheme.txt +++ /dev/null @@ -1,160 +0,0 @@ - -table:caddie -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:user_id table:caddie type:smallint nullable:N length:5 signed:Y -column:element_id table:caddie type:mediumint nullable:N length:8 signed:Y -column:id table:categories type:smallint nullable:N length:5 signed:N -column:date_last table:categories type:datetime 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:validation_date table:comments type:datetime nullable:Y -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:datetime 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:Y length:32 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:last_feed_check table:users type:datetime nullable:Y -column:feed_id table:users type:varchar nullable:Y length:50 binary:Y -column:registration_date table:users type:datetime nullable: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:caddie_pk table:caddie column:user_id -PK:caddie_pk table:caddie column:element_id -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:comments_i2 table:comments column:validation_date -index:comments_i1 table:comments column:image_id -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 diff --git a/install/upgrade_1.3.0.php b/install/upgrade_1.3.0.php deleted file mode 100644 index 430a14ed0..000000000 --- a/install/upgrade_1.3.0.php +++ /dev/null @@ -1,401 +0,0 @@ -<?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$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | 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>' - - ); - -?>
\ No newline at end of file diff --git a/install/upgrade_1.3.1.php b/install/upgrade_1.3.1.php deleted file mode 100644 index 0e130a19d..000000000 --- a/install/upgrade_1.3.1.php +++ /dev/null @@ -1,363 +0,0 @@ -<?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$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | 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>' - - ); - -?>
\ No newline at end of file diff --git a/install/upgrade_1.3.2.php b/install/upgrade_1.3.2.php deleted file mode 100644 index b046cf112..000000000 --- a/install/upgrade_1.3.2.php +++ /dev/null @@ -1,362 +0,0 @@ -<?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$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | 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>' - - ); - -?>
\ No newline at end of file diff --git a/install/upgrade_1.3.3.php b/install/upgrade_1.3.3.php deleted file mode 100644 index b046cf112..000000000 --- a/install/upgrade_1.3.3.php +++ /dev/null @@ -1,362 +0,0 @@ -<?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$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | 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>' - - ); - -?>
\ No newline at end of file diff --git a/install/upgrade_1.3.4.php b/install/upgrade_1.3.4.php deleted file mode 100644 index b046cf112..000000000 --- a/install/upgrade_1.3.4.php +++ /dev/null @@ -1,362 +0,0 @@ -<?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$ -// | last update : $Date$ -// | last modifier : $Author$ -// | revision : $Revision$ -// +-----------------------------------------------------------------------+ -// | 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>' - - ); - -?>
\ No newline at end of file diff --git a/install/upgrade_1.4.0.php b/install/upgrade_1.4.0.php new file mode 100644 index 000000000..ea17f32a4 --- /dev/null +++ b/install/upgrade_1.4.0.php @@ -0,0 +1,275 @@ +<?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$ +// | last update : $Date$ +// | last modifier : $Author$ +// | revision : $Revision$ +// +-----------------------------------------------------------------------+ +// | 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 ('This page cannot be loaded directly, load upgrade.php'); +} +else +{ + if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE) + { + die ('Hacking attempt!'); + } +} + +$last_time = get_moment(); + +// will the user have to edit include/config_local.inc.php for +// prefix_thumbnail configuration parameter +$query = ' +SELECT value + FROM '.CONFIG_TABLE.' + WHERE param = \'prefix_thumbnail\' +;'; +list($prefix_thumbnail) = mysql_fetch_array(pwg_query($query)); + +// delete obsolete configuration +$query = ' +DELETE + FROM '.PREFIX_TABLE.'config + WHERE param IN ( + \'prefix_thumbnail\', + \'mail_webmaster\', + \'upload_maxfilesize\', + \'upload_maxwidth\', + \'upload_maxheight\', + \'upload_maxwidth_thumbnail\', + \'upload_maxheight_thumbnail\', + \'mail_notification\' + ) +;'; +mysql_query($query); + +$queries = array( + + " +ALTER TABLE phpwebgallery_categories + CHANGE COLUMN date_last date_last datetime default NULL +;", + + " +ALTER TABLE phpwebgallery_comments + ADD COLUMN validation_date datetime default NULL +;", + + " +UPDATE phpwebgallery_comments + SET validation_date = date +", + + " +ALTER TABLE phpwebgallery_comments + ADD INDEX comments_i1 (image_id) +;", + + " +ALTER TABLE phpwebgallery_comments + ADD INDEX comments_i2 (validation_date) +;", + + " +ALTER TABLE phpwebgallery_favorites + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_images + CHANGE COLUMN date_available + date_available datetime NOT NULL default '0000-00-00 00:00:00' +;", + + " +ALTER TABLE phpwebgallery_rate + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_sessions + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_user_access + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +DROP TABLE phpwebgallery_user_forbidden +;", + + " +ALTER TABLE phpwebgallery_user_group + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_users + CHANGE COLUMN id id smallint(5) NOT NULL auto_increment +;", + + " +CREATE TABLE phpwebgallery_caddie ( + user_id smallint(5) NOT NULL default '0', + element_id mediumint(8) NOT NULL default '0', + PRIMARY KEY (user_id,element_id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_cache ( + user_id smallint(5) NOT NULL default '0', + need_update enum('true','false') NOT NULL default 'true', + forbidden_categories text, + PRIMARY KEY (user_id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_feed ( + id varchar(50) binary NOT NULL default '', + user_id smallint(5) NOT NULL default '0', + last_check datetime default NULL, + PRIMARY KEY (id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_infos ( + user_id smallint(5) NOT NULL default '0', + 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 'yoga', + registration_date datetime NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY user_infos_ui1 (user_id) +) TYPE=MyISAM +;" + ); + +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; + +// user datas migration from phpwebgallery_users to phpwebgallery_user_infos +$query = ' +SELECT * + FROM '.USERS_TABLE.' +;'; + +$datas = array(); +list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); + +$result = pwg_query($query); +while ($row = mysql_fetch_array($result)) +{ + $row['user_id'] = $row['id']; + $row['registration_date'] = $dbnow; + array_push($datas, $row); +} + +include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); +mass_inserts( + USER_INFOS_TABLE, + array( + 'user_id', + 'nb_image_line', + 'nb_line_page', + 'status', + 'language', + 'maxwidth', + 'maxheight', + 'expand', + 'show_nb_comments', + 'recent_period', + 'template', + 'registration_date' + ), + $datas + ); + +$queries = array( + + " +UPDATE ".USER_INFOS_TABLE." + SET template = 'yoga' +;", + + " +UPDATE ".USER_INFOS_TABLE." + SET language = 'en_UK.iso-8859-1' + WHERE language NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1') +;", + + " +UPDATE ".CONFIG_TABLE." + SET value = 'en_UK.iso-8859-1' + WHERE param = 'default_language' + AND value NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1') +;", + + " +UPDATE ".CONFIG_TABLE." + SET value = 'yoga' + WHERE param = 'default_template' +;" + + ); + +foreach ($queries as $query) +{ + $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); + pwg_query($query); +} + +$infos = array(); + +if ($prefix_thumbnail != 'TN-') +{ + array_push( + $infos, + 'the thumbnail prefix configuration parameter was moved to configuration +file, copy config_local.inc.php from "tools" directory to "include" directory +and edit $conf[\'prefix_thumbnail\'] = '.$prefix_thumbnail + ); +} + +?>
\ No newline at end of file diff --git a/install/upgrade_1.4.1.php b/install/upgrade_1.4.1.php new file mode 100644 index 000000000..ea17f32a4 --- /dev/null +++ b/install/upgrade_1.4.1.php @@ -0,0 +1,275 @@ +<?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$ +// | last update : $Date$ +// | last modifier : $Author$ +// | revision : $Revision$ +// +-----------------------------------------------------------------------+ +// | 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 ('This page cannot be loaded directly, load upgrade.php'); +} +else +{ + if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE) + { + die ('Hacking attempt!'); + } +} + +$last_time = get_moment(); + +// will the user have to edit include/config_local.inc.php for +// prefix_thumbnail configuration parameter +$query = ' +SELECT value + FROM '.CONFIG_TABLE.' + WHERE param = \'prefix_thumbnail\' +;'; +list($prefix_thumbnail) = mysql_fetch_array(pwg_query($query)); + +// delete obsolete configuration +$query = ' +DELETE + FROM '.PREFIX_TABLE.'config + WHERE param IN ( + \'prefix_thumbnail\', + \'mail_webmaster\', + \'upload_maxfilesize\', + \'upload_maxwidth\', + \'upload_maxheight\', + \'upload_maxwidth_thumbnail\', + \'upload_maxheight_thumbnail\', + \'mail_notification\' + ) +;'; +mysql_query($query); + +$queries = array( + + " +ALTER TABLE phpwebgallery_categories + CHANGE COLUMN date_last date_last datetime default NULL +;", + + " +ALTER TABLE phpwebgallery_comments + ADD COLUMN validation_date datetime default NULL +;", + + " +UPDATE phpwebgallery_comments + SET validation_date = date +", + + " +ALTER TABLE phpwebgallery_comments + ADD INDEX comments_i1 (image_id) +;", + + " +ALTER TABLE phpwebgallery_comments + ADD INDEX comments_i2 (validation_date) +;", + + " +ALTER TABLE phpwebgallery_favorites + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_images + CHANGE COLUMN date_available + date_available datetime NOT NULL default '0000-00-00 00:00:00' +;", + + " +ALTER TABLE phpwebgallery_rate + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_sessions + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_user_access + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +DROP TABLE phpwebgallery_user_forbidden +;", + + " +ALTER TABLE phpwebgallery_user_group + CHANGE COLUMN user_id user_id smallint(5) NOT NULL default '0' +;", + + " +ALTER TABLE phpwebgallery_users + CHANGE COLUMN id id smallint(5) NOT NULL auto_increment +;", + + " +CREATE TABLE phpwebgallery_caddie ( + user_id smallint(5) NOT NULL default '0', + element_id mediumint(8) NOT NULL default '0', + PRIMARY KEY (user_id,element_id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_cache ( + user_id smallint(5) NOT NULL default '0', + need_update enum('true','false') NOT NULL default 'true', + forbidden_categories text, + PRIMARY KEY (user_id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_feed ( + id varchar(50) binary NOT NULL default '', + user_id smallint(5) NOT NULL default '0', + last_check datetime default NULL, + PRIMARY KEY (id) +) TYPE=MyISAM +;", + + " +CREATE TABLE phpwebgallery_user_infos ( + user_id smallint(5) NOT NULL default '0', + 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 'yoga', + registration_date datetime NOT NULL default '0000-00-00 00:00:00', + UNIQUE KEY user_infos_ui1 (user_id) +) TYPE=MyISAM +;" + ); + +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; + +// user datas migration from phpwebgallery_users to phpwebgallery_user_infos +$query = ' +SELECT * + FROM '.USERS_TABLE.' +;'; + +$datas = array(); +list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); + +$result = pwg_query($query); +while ($row = mysql_fetch_array($result)) +{ + $row['user_id'] = $row['id']; + $row['registration_date'] = $dbnow; + array_push($datas, $row); +} + +include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); +mass_inserts( + USER_INFOS_TABLE, + array( + 'user_id', + 'nb_image_line', + 'nb_line_page', + 'status', + 'language', + 'maxwidth', + 'maxheight', + 'expand', + 'show_nb_comments', + 'recent_period', + 'template', + 'registration_date' + ), + $datas + ); + +$queries = array( + + " +UPDATE ".USER_INFOS_TABLE." + SET template = 'yoga' +;", + + " +UPDATE ".USER_INFOS_TABLE." + SET language = 'en_UK.iso-8859-1' + WHERE language NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1') +;", + + " +UPDATE ".CONFIG_TABLE." + SET value = 'en_UK.iso-8859-1' + WHERE param = 'default_language' + AND value NOT IN ('en_UK.iso-8859-1', 'fr_FR.iso-8859-1') +;", + + " +UPDATE ".CONFIG_TABLE." + SET value = 'yoga' + WHERE param = 'default_template' +;" + + ); + +foreach ($queries as $query) +{ + $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); + pwg_query($query); +} + +$infos = array(); + +if ($prefix_thumbnail != 'TN-') +{ + array_push( + $infos, + 'the thumbnail prefix configuration parameter was moved to configuration +file, copy config_local.inc.php from "tools" directory to "include" directory +and edit $conf[\'prefix_thumbnail\'] = '.$prefix_thumbnail + ); +} + +?>
\ No newline at end of file diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl index 85007a15e..55bd2157b 100644 --- a/template/yoga/picture.tpl +++ b/template/yoga/picture.tpl @@ -5,7 +5,10 @@ <div id="imageHeaderBar"> <div class="browsePath"><a href="{U_HOME}">{L_HOME}</a>{LEVEL_SEPARATOR}{CATEGORY}</div> <div class="imageNumber">{PHOTO}</div> + <!-- BEGIN title --> <h1>{TITLE}</h1> + <!-- END title --> + <hr class="separation"> </div> <div id="imageToolBar"> diff --git a/tools/config_local.inc.php b/tools/config_local.inc.php new file mode 100644 index 000000000..6e74538fb --- /dev/null +++ b/tools/config_local.inc.php @@ -0,0 +1,8 @@ +<?php +// this file is provided as an example. It does not modify the configuration +// as long as it remains in "tools" directory. Move it to "include" +// directory if you want to modify default configuration. + +$conf['prefix_thumbnail'] = 'thumb_'; +$conf['show_gt'] = true; +?>
\ No newline at end of file diff --git a/upgrade.php b/upgrade.php index 35492b74f..68878f11e 100644 --- a/upgrade.php +++ b/upgrade.php @@ -25,7 +25,6 @@ // | USA. | // +-----------------------------------------------------------------------+ -define('IN_UPGRADE', true); define('PHPWG_ROOT_PATH', './'); include_once(PHPWG_ROOT_PATH.'include/functions.inc.php'); @@ -34,17 +33,20 @@ include(PHPWG_ROOT_PATH.'include/template.php'); include(PHPWG_ROOT_PATH.'include/mysql.inc.php'); // Is PhpWebGallery already installed ? -if (defined('PHPWG_INSTALLED')) +if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE) { - $message = 'PhpWebGallery is already installed. In include/mysql.inc.php, -remove line + $message = 'PhpWebGallery is not in upgrade mode. In include/mysql.inc.php, +insert line <pre style="background-color:lightgray"> -define(\'PHPWG_INSTALLED\', true); +define(\'PHPWG_IN_UPGRADE\', true); </pre> if you want to upgrade'; die($message); } +// concerning upgrade, we use the default users table +$conf['users_table'] = $prefixeTable.'users'; + include_once(PHPWG_ROOT_PATH.'include/constants.php'); define('PREFIX_TABLE', $prefixeTable); @@ -113,9 +115,11 @@ function execute_sqlfile($filepath, $replaced, $replacing) // +-----------------------------------------------------------------------+ // | template initialization | // +-----------------------------------------------------------------------+ -$template = setup_style('default'); + +$template = new Template(PHPWG_ROOT_PATH.'template/yoga'); $template->set_filenames(array('upgrade'=>'upgrade.tpl')); $template->assign_vars(array('RELEASE'=>PHPWG_VERSION)); + // +-----------------------------------------------------------------------+ // | versions upgradable | // +-----------------------------------------------------------------------+ @@ -178,7 +182,16 @@ else array_push( $infos, '[security] delete files "upgrade.php", "install.php" and "install" -directory'); +directory' + ); + + array_push( + $infos, + 'in include/mysql.inc.php, remove +<pre style="background-color:lightgray"> +define(\'PHPWG_IN_UPGRADE\', true); +</pre>' + ); $template->assign_block_vars('upgrade.infos', array()); |