diff options
Diffstat (limited to '')
-rw-r--r-- | install/db/1-database.php | 46 | ||||
-rw-r--r-- | install/db/10-database.php | 56 | ||||
-rw-r--r-- | install/db/11-database.php | 69 | ||||
-rw-r--r-- | install/db/12-database.php | 103 | ||||
-rw-r--r-- | install/db/13-database.php | 73 | ||||
-rw-r--r-- | install/db/14-database.php | 63 | ||||
-rw-r--r-- | install/db/15-database.php | 50 | ||||
-rw-r--r-- | install/db/16-database.php | 54 | ||||
-rw-r--r-- | install/db/17-database.php | 64 | ||||
-rw-r--r-- | install/db/18-database.php | 92 | ||||
-rw-r--r-- | install/db/19-database.php | 153 | ||||
-rw-r--r-- | install/db/2-database.php | 78 | ||||
-rw-r--r-- | install/db/21-database.php | 52 | ||||
-rw-r--r-- | install/db/22-database.php | 58 | ||||
-rw-r--r-- | install/db/3-database.php | 57 | ||||
-rw-r--r-- | install/db/4-database.php | 54 | ||||
-rw-r--r-- | install/db/5-database.php | 50 | ||||
-rw-r--r-- | install/db/6-database.php | 58 | ||||
-rw-r--r-- | install/db/7-database.php | 70 | ||||
-rw-r--r-- | install/db/8-database.php | 88 | ||||
-rw-r--r-- | install/db/9-database.php | 90 | ||||
-rw-r--r-- | install/upgrade_1.3.0.php (renamed from install/db/20-database.php) | 129 |
22 files changed, 84 insertions, 1523 deletions
diff --git a/install/db/1-database.php b/install/db/1-database.php deleted file mode 100644 index 5bbb59d44..000000000 --- a/install/db/1-database.php +++ /dev/null @@ -1,46 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Just a beginning test'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -list($now) = mysql_fetch_row(pwg_query('SELECT NOW()')); -echo -$now -."\n" -.'This upgrade script is for test purpose only' -."\n" -; -?> diff --git a/install/db/10-database.php b/install/db/10-database.php deleted file mode 100644 index 24a7f655e..000000000 --- a/install/db/10-database.php +++ /dev/null @@ -1,56 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'New table #categories_link'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -$query = " -CREATE TABLE phpwebgallery_categories_link ( - source smallint(5) unsigned NOT NULL default '0', - destination smallint(5) unsigned NOT NULL default '0', - PRIMARY KEY (source,destination) -) TYPE=MyISAM;"; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Table '.PREFIX_TABLE.'categories_link created' -."\n" -; -?> diff --git a/install/db/11-database.php b/install/db/11-database.php deleted file mode 100644 index bb2ea8421..000000000 --- a/install/db/11-database.php +++ /dev/null @@ -1,69 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = - 'Table #categories_link created once again with correct prefix'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -if (PREFIX_TABLE == 'phpwebgallery_') -{ - echo - "\n" - .'Table '.PREFIX_TABLE.'categories_link was already correctly created' - ."\n" - ; -} -else -{ - $query = ' -DROP TABLE phpwebgallery_categories_link; -;'; - pwg_query($query); - - $query = " -CREATE TABLE ".PREFIX_TABLE."categories_link ( - source smallint(5) unsigned NOT NULL default '0', - destination smallint(5) unsigned NOT NULL default '0', - PRIMARY KEY (source,destination) -) TYPE=MyISAM;"; - pwg_query($query); - - echo - "\n" - .'Table '.PREFIX_TABLE.'categories_link created' - ."\n" - ; -} -?> diff --git a/install/db/12-database.php b/install/db/12-database.php deleted file mode 100644 index 3e6ed0200..000000000 --- a/install/db/12-database.php +++ /dev/null @@ -1,103 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Field "Status" Table #user_infos changed'; - -include_once(PHPWG_ROOT_PATH.'include/constants.php'); -include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); -@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -echo "Alter table ".USER_INFOS_TABLE; -$query = " -alter table ".USER_INFOS_TABLE." - modify column `status` enum('webmaster', 'admin', 'normal', 'generic', 'guest') NOT NULL default 'guest' -;"; -pwg_query($query); - -echo "Define webmaster"; -$query = ' -update - '.USER_INFOS_TABLE.' -set status = \'webmaster\' -where - user_id = '.$conf['webmaster_id'].' and status = \'admin\' -;'; -$result = pwg_query($query); - -echo "Define normal"; -$query = ' -select - user_id -from - '.USER_INFOS_TABLE.' -where - user_id != '.$conf['guest_id'].' and status = \'guest\' -;'; -$result = pwg_query($query); - -$datas = array(); - -while ($row = mysql_fetch_array($result)) -{ - array_push( - $datas, - array( - 'user_id' => $row['user_id'], - 'status' => 'normal' - ) - ); -} - -mass_updates( - USER_INFOS_TABLE, - array( - 'primary' => array('user_id'), - 'update' => array('status') - ), - $datas - ); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Column '.USER_INFOS_TABLE.'.status changed' -."\n" -; - -?> diff --git a/install/db/13-database.php b/install/db/13-database.php deleted file mode 100644 index ac35cc40c..000000000 --- a/install/db/13-database.php +++ /dev/null @@ -1,73 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = '#config (gallery_description out page_banner in)'; - -$query = " -ALTER TABLE ".PREFIX_TABLE."config MODIFY COLUMN `value` TEXT;"; -pwg_query($query); - - -$query = ' -SELECT value - FROM '.PREFIX_TABLE.'config - WHERE param=\'gallery_title\' -;'; -list($t) = array_from_query($query, 'value'); - -$query = ' -SELECT value - FROM '.PREFIX_TABLE.'config - WHERE param=\'gallery_description\' -;'; -list($d) = array_from_query($query, 'value'); - -$page_banner='<div id="theHeader"><h1>'.$t.'</h1><p>'.$d.'</p></div>'; -$page_banner=addslashes($page_banner); -$query = ' -INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' . -"'page_banner','$page_banner','html displayed on the top each page of your gallery');"; -pwg_query($query); - -$query = ' -DELETE FROM '.PREFIX_TABLE.'config - WHERE param=\'gallery_description\' -;'; -pwg_query($query); - - -echo -"\n" -.'Table '.PREFIX_TABLE.'config updated' -."\n" -; -?> diff --git a/install/db/14-database.php b/install/db/14-database.php deleted file mode 100644 index e9f50174a..000000000 --- a/install/db/14-database.php +++ /dev/null @@ -1,63 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Update database to new pwg_high structure'; - -include_once(PHPWG_ROOT_PATH.'include/constants.php'); -include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); -@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -echo "Alter table ".USER_INFOS_TABLE. ' add field enabled_high'; -$query = " -alter table ".USER_INFOS_TABLE." - add column `enabled_high` enum('true','false') NOT NULL default 'true' -;"; -pwg_query($query); - -echo "Update ".USER_INFOS_TABLE.".enabled_high with default value"; -$query = " -update ".USER_INFOS_TABLE." set enabled_high = '".$conf['newuser_default_enabled_high']."' -where enabled_high <> '".$conf['newuser_default_enabled_high']."' -;"; -pwg_query($query); - -echo -"\n" -.'"'.$upgrade_description.'"'.' ended' -."\n" -; - -?> diff --git a/install/db/15-database.php b/install/db/15-database.php deleted file mode 100644 index b5ff23a7c..000000000 --- a/install/db/15-database.php +++ /dev/null @@ -1,50 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = '#user_cache, add column nb_total_pictures (feature 262)'; - -$query = " -ALTER TABLE ".PREFIX_TABLE."user_cache ADD COLUMN `nb_total_images` MEDIUMINT(8) UNSIGNED;"; -pwg_query($query); - -$query = " -UPDATE ".PREFIX_TABLE."user_cache SET need_update='true'"; -pwg_query($query); - - -echo -"\n" -.'"'.$upgrade_description.'"'.' ended' -."\n" -; - -?> diff --git a/install/db/16-database.php b/install/db/16-database.php deleted file mode 100644 index 4187b2cc4..000000000 --- a/install/db/16-database.php +++ /dev/null @@ -1,54 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Update database from adviser functionnality'; - -include_once(PHPWG_ROOT_PATH.'include/constants.php'); - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -echo "Alter table ".USER_INFOS_TABLE. ' add field adviser'; -$query = " -alter table ".USER_INFOS_TABLE." - add column `adviser` enum('true','false') NOT NULL default 'false' after `status` -;"; -pwg_query($query); - -echo -"\n" -.'"'.$upgrade_description.'"'.' ended' -."\n" -; - -?> diff --git a/install/db/17-database.php b/install/db/17-database.php deleted file mode 100644 index 820ca6194..000000000 --- a/install/db/17-database.php +++ /dev/null @@ -1,64 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Add notification by mail param'; - -include_once(PHPWG_ROOT_PATH.'include/constants.php'); - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -echo "Add param on ".CONFIG_TABLE; -$query = " -INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_mail_as','','Send mail as param value for notification by mail'); -"; -pwg_query($query); - - -$query = " -INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_send_detailed_content','true','Send detailed content for notification by mail'); -"; -pwg_query($query); - -$query = " -INSERT INTO ".CONFIG_TABLE." (param,value,comment) VALUES ('nbm_complementary_mail_content','','Complementary mail content for notification by mail'); -"; -pwg_query($query); - -echo -"\n" -.'"'.$upgrade_description.'"'.' ended' -."\n" -; - -?> diff --git a/install/db/18-database.php b/install/db/18-database.php deleted file mode 100644 index 13fb615bf..000000000 --- a/install/db/18-database.php +++ /dev/null @@ -1,92 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Reduce length of #_user_mail_notification.check_key'; - -include_once(PHPWG_ROOT_PATH.'include/constants.php'); - -include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); -include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php'); - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ -echo "Compute new check_key"; -$query = ' -select - user_id -from - '.USER_MAIL_NOTIFICATION_TABLE.' -;'; -$result = pwg_query($query); - -$datas = array(); - -while ($row = mysql_fetch_array($result)) -{ - array_push( - $datas, - array( - 'user_id' => $row['user_id'], - 'check_key' => find_available_check_key() - ) - ); -} - -mass_updates( - USER_MAIL_NOTIFICATION_TABLE, - array( - 'primary' => array('user_id'), - 'update' => array('check_key') - ), - $datas - ); - -echo "Alter table ".USER_MAIL_NOTIFICATION_TABLE; -$query = " -alter table ".USER_MAIL_NOTIFICATION_TABLE." - modify column `check_key` varchar(16) binary NOT NULL default '' -;"; -pwg_query($query); - - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Column '.USER_MAIL_NOTIFICATION_TABLE.'.check_key changed' -."\n" -; - -?> diff --git a/install/db/19-database.php b/install/db/19-database.php deleted file mode 100644 index d1fdb4a74..000000000 --- a/install/db/19-database.php +++ /dev/null @@ -1,153 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = '#images.keywords moved to new table #tags'; - -// +-----------------------------------------------------------------------+ -// | New tables | -// +-----------------------------------------------------------------------+ - -$query = ' -CREATE TABLE '.PREFIX_TABLE.'tags ( - id smallint(5) UNSIGNED NOT NULL auto_increment, - name varchar(255) BINARY NOT NULL, - url_name varchar(255) BINARY NOT NULL, - PRIMARY KEY (id) -) TYPE=MyISAM -;'; -pwg_query($query); - -$query = ' -CREATE TABLE '.PREFIX_TABLE.'image_tag ( - image_id mediumint(8) UNSIGNED NOT NULL, - tag_id smallint(5) UNSIGNED NOT NULL, - PRIMARY KEY (image_id,tag_id) -) TYPE=MyISAM -;'; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | Move keywords to tags | -// +-----------------------------------------------------------------------+ - -// each tag label is associated to a numeric identifier -$tag_id = array(); -// to each tag id (key) a list of image ids (value) is associated -$tag_images = array(); - -$current_id = 1; - -$query = ' -SELECT id, keywords - FROM '.PREFIX_TABLE.'images - WHERE keywords IS NOT NULL -;'; -$result = pwg_query($query); -while ($row = mysql_fetch_array($result)) -{ - foreach(preg_split('/[,]+/', $row['keywords']) as $keyword) - { - if (!isset($tag_id[$keyword])) - { - $tag_id[$keyword] = $current_id++; - } - - if (!isset($tag_images[ $tag_id[$keyword] ])) - { - $tag_images[ $tag_id[$keyword] ] = array(); - } - - array_push($tag_images[ $tag_id[$keyword] ], $row['id']); - } -} - -$datas = array(); -foreach ($tag_id as $tag_name => $tag_id) -{ - array_push( - $datas, - array( - 'id' => $tag_id, - 'name' => $tag_name, - 'url_name' => str2url($tag_name), - ) - ); -} -if (!empty($datas)) -mass_inserts( - PREFIX_TABLE.'tags', - array_keys($datas[0]), - $datas - ); - -$datas = array(); -foreach ($tag_images as $tag_id => $images) -{ - foreach (array_unique($images) as $image_id) - { - array_push( - $datas, - array( - 'tag_id' => $tag_id, - 'image_id' => $image_id, - ) - ); - } -} - -if (!empty($datas)) -mass_inserts( - PREFIX_TABLE.'image_tag', - array_keys($datas[0]), - $datas - ); - -// +-----------------------------------------------------------------------+ -// | Delete images.keywords | -// +-----------------------------------------------------------------------+ - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'images DROP COLUMN keywords -;'; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Table '.PREFIX_TABLE.'tags created and filled'."\n" -.'Table '.PREFIX_TABLE.'image_tag created and filled'."\n" -.'Column '.PREFIX_TABLE.'images.keywords dropped'."\n" -; -?> diff --git a/install/db/2-database.php b/install/db/2-database.php deleted file mode 100644 index 9a249703a..000000000 --- a/install/db/2-database.php +++ /dev/null @@ -1,78 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Update template preference for every user'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -// configuration update -$query = ' -UPDATE '.PREFIX_TABLE.'config - SET value = \'yoga/clear\' - WHERE param = \'default_template\' -;'; -pwg_query($query); - -// set yoga/clear as default value for user_infos.template column -$query = ' -ALTER TABLE '.PREFIX_TABLE.'user_infos - CHANGE COLUMN template template varchar(255) NOT NULL default \'yoga/clear\' -;'; -pwg_query($query); - -// users having yoga-dark for template now have yoga/dark -$query = ' -UPDATE '.PREFIX_TABLE.'user_infos - SET template = \'yoga/dark\' - WHERE template = \'yoga-dark\' -;'; -pwg_query($query); - -// all other users have yoga/clear -$query = ' -UPDATE '.PREFIX_TABLE.'user_infos - SET template = \'yoga/clear\' - WHERE template != \'yoga/dark\' -;'; -pwg_query($query); - -echo -"\n" -.'Default template modified to yoga/clear' -."\n" -.'Template preference modified for every users : yoga/dark' -.' (for yoga-dark users) and yoga/clear as default' -."\n" -; -?> diff --git a/install/db/21-database.php b/install/db/21-database.php deleted file mode 100644 index cfd08c692..000000000 --- a/install/db/21-database.php +++ /dev/null @@ -1,52 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'drop table #categories_link'; - -// +-----------------------------------------------------------------------+ -// | New column | -// +-----------------------------------------------------------------------+ - -$query = ' -DROP TABLE '.PREFIX_TABLE.'categories_link -;'; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Table '.PREFIX_TABLE.'categories_link dropped'."\n" -; -?> diff --git a/install/db/22-database.php b/install/db/22-database.php deleted file mode 100644 index fcead3cf2..000000000 --- a/install/db/22-database.php +++ /dev/null @@ -1,58 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'add index on #tags.url_name and #image_tag.tag_id '; - - - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'tags ADD INDEX `tags_i1`(`url_name`); -;'; -pwg_query($query); - - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'image_tag ADD INDEX `image_tag_i1`(`tag_id`); -;'; -pwg_query($query); - - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Tables '.PREFIX_TABLE.'tags and '.PREFIX_TABLE.'image_tag updated'."\n" -; -echo $upgrade_description; -?> diff --git a/install/db/3-database.php b/install/db/3-database.php deleted file mode 100644 index abcaa79aa..000000000 --- a/install/db/3-database.php +++ /dev/null @@ -1,57 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Update session table for new session system'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -// delete content of old session table -$query = ' -DELETE FROM '.PREFIX_TABLE.'sessions -;'; -pwg_query($query); - -// column user_id becomes data of type text -$query = ' -ALTER TABLE '.PREFIX_TABLE.'sessions - CHANGE COLUMN user_id data text NOT NULL -;'; -pwg_query($query); - -echo -"\n" -.'Column modified in sessions table' -."\n" -; -?> diff --git a/install/db/4-database.php b/install/db/4-database.php deleted file mode 100644 index c74486a46..000000000 --- a/install/db/4-database.php +++ /dev/null @@ -1,54 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Table #search is required for search engine redesign'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -// column user_id becomes data of type text -$query = ' -CREATE TABLE '.PREFIX_TABLE.'search ( - id int UNSIGNED NOT NULL AUTO_INCREMENT, - last_seen date DEFAULT NULL, - rules text, - PRIMARY KEY (id) -);'; -pwg_query($query); - -echo -"\n" -.'Table '.PREFIX_TABLE.'search created' -."\n" -; -?> diff --git a/install/db/5-database.php b/install/db/5-database.php deleted file mode 100644 index 0dc2006d0..000000000 --- a/install/db/5-database.php +++ /dev/null @@ -1,50 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Update images table with has_high column'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -// column user_id becomes data of type text -$query = " -ALTER TABLE ".PREFIX_TABLE."images ADD COLUMN has_high ENUM('true') DEFAULT NULL AFTER average_rate; -"; -pwg_query($query); - -echo -"\n" -.'Column has_high '.PREFIX_TABLE.'images added' -."\n" -; -?> diff --git a/install/db/6-database.php b/install/db/6-database.php deleted file mode 100644 index 08bcf6aea..000000000 --- a/install/db/6-database.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | -// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Table #user_mail_notification is required for NBM'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -// Creating table user_mail_notification -$query = ' -CREATE TABLE '.PREFIX_TABLE.'user_mail_notification -( - user_id smallint(5) NOT NULL default \'0\', - check_key varchar(128) binary NOT NULL, - enabled enum(\'true\',\'false\') NOT NULL default \'false\', - last_send datetime default NULL, - PRIMARY KEY (`user_id`), - UNIQUE KEY `uidx_check_key` (`check_key`) -) TYPE=MyISAM;'; -pwg_query($query); - -echo -"\n" -.'Table '.PREFIX_TABLE.'user_mail_notification created' -."\n" -; -?> diff --git a/install/db/7-database.php b/install/db/7-database.php deleted file mode 100644 index 5ad118506..000000000 --- a/install/db/7-database.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | -// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Anonymous rating'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'rate DROP PRIMARY KEY;' -; -pwg_query($query); - -$query =' -ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN anonymous_id VARCHAR(45) NOT NULL DEFAULT \'\' AFTER element_id;' -; -pwg_query($query); - -$query =' -ALTER TABLE '.PREFIX_TABLE.'rate ADD COLUMN date DATE NOT NULL AFTER rate;' -; -pwg_query($query); - -$query =' -UPDATE '.PREFIX_TABLE.'rate SET date=NOW() WHERE date<"1990-01-01";' -; -pwg_query($query); - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'rate ADD PRIMARY KEY (element_id, user_id, anonymous_id);' -; -pwg_query($query); - -echo -"\n" -.'Table '.PREFIX_TABLE.'rate upgraded' -."\n" -; -?> diff --git a/install/db/8-database.php b/install/db/8-database.php deleted file mode 100644 index ecbc8bf5e..000000000 --- a/install/db/8-database.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -// +-----------------------------------------------------------------------+ -// | PhpWebGallery - a PHP based picture gallery | -// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net | -// | Copyright (C) 2003-2006 PhpWebGallery Team - http://phpwebgallery.net | -// | Copyright (C) 2006 Ruben ARNAUD - team@phpwebgallery.net | -// +-----------------------------------------------------------------------+ -// | branch : BSF (Best So Far) -// | file : $RCSfile$ -// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = 'Move rate, rate_anonymous and gallery_url from config file to database'; - -$params = array( - 'gallery_url' => array('http://demo.phpwebgallery.net','URL given in RSS feed'), - 'rate' => array('true','Rating pictures feature is enabled') , - 'rate_anonymous' => array('true','Rating pictures feature is also enabled for visitors') - ); - - - -// +-Get real values from config file--------------------------------------+ - -$conf_save = $conf; -unset($conf); -@include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); -if ( isset($conf['gallery_url']) ) -{ - $params['gallery_url'][0] = $conf['gallery_url']; -} -if ( isset($conf['rate']) and is_bool($conf['rate']) ) -{ - $params['rate'][0] = $conf['rate'] ? 'true' : 'false'; -} -if ( isset($conf['rate_anonymous']) and is_bool($conf['rate_anonymous']) ) -{ - $params['rate_anonymous'][0] = $conf['rate_anonymous'] ? 'true' : 'false'; -} -$conf = $conf_save; - - - -// +-Do I already have them in DB ?----------------------------------------+ -$query = 'SELECT param FROM '.PREFIX_TABLE.'config'; -$result = pwg_query($query); -while ($row = mysql_fetch_array($result)) -{ - unset( $params[ $row['param'] ] ); -} - -// +-Perform the insert query----------------------------------------------+ -foreach ($params as $param_key => $param_values) -{ - $query = ' -INSERT INTO '.PREFIX_TABLE.'config (param,value,comment) VALUES (' . -"'$param_key','$param_values[0]','$param_values[1]');"; - pwg_query($query); -} - - -echo -"\n" -.'Table '.PREFIX_TABLE.'config upgraded' -."\n" -; -?> diff --git a/install/db/9-database.php b/install/db/9-database.php deleted file mode 100644 index 3abf384a3..000000000 --- a/install/db/9-database.php +++ /dev/null @@ -1,90 +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: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ -// | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ -// +-----------------------------------------------------------------------+ -// | This program is free software; you can redistribute it and/or modify | -// | it under the terms of the GNU General Public License as published by | -// | the Free Software Foundation | -// | | -// | This program is distributed in the hope that it will be useful, but | -// | WITHOUT ANY WARRANTY; without even the implied warranty of | -// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | -// | General Public License for more details. | -// | | -// | You should have received a copy of the GNU General Public License | -// | along with this program; if not, write to the Free Software | -// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | -// | USA. | -// +-----------------------------------------------------------------------+ - -if (!defined('PHPWG_ROOT_PATH')) -{ - die('Hacking attempt!'); -} - -$upgrade_description = - 'Column #image_category.is_storage replaces #images.storage_category_id'; - -// +-----------------------------------------------------------------------+ -// | Upgrade content | -// +-----------------------------------------------------------------------+ - -$query = " -ALTER TABLE ".PREFIX_TABLE."image_category - ADD COLUMN is_storage ENUM('true','false') DEFAULT 'false' -;"; -pwg_query($query); - -$query = ' -SELECT id, storage_category_id - FROM '.PREFIX_TABLE.'images -;'; -$result = pwg_query($query); - -$datas = array(); - -while ($row = mysql_fetch_array($result)) -{ - array_push( - $datas, - array( - 'image_id' => $row['id'], - 'category_id' => $row['storage_category_id'], - 'is_storage' => 'true', - ) - ); -} - -mass_updates( - PREFIX_TABLE.'image_category', - array( - 'primary' => array('image_id', 'category_id'), - 'update' => array('is_storage') - ), - $datas - ); - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'images - DROP COLUMN storage_category_id -;'; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Column '.PREFIX_TABLE.'image_category.is_storage created and filled' -."\n" -; -?> diff --git a/install/db/20-database.php b/install/upgrade_1.3.0.php index 5dba69168..f5d650e6b 100644 --- a/install/db/20-database.php +++ b/install/upgrade_1.3.0.php @@ -6,9 +6,9 @@ // +-----------------------------------------------------------------------+ // | branch : BSF (Best So Far) // | file : $RCSfile$ -// | last update : $Date: 2005-09-21 00:04:57 +0200 (mer, 21 sep 2005) $ +// | last update : $Date: 2005-01-08 00:10:51 +0100 (sam, 08 jan 2005) $ // | last modifier : $Author: plg $ -// | revision : $Revision: 870 $ +// | revision : $Revision: 675 $ // +-----------------------------------------------------------------------+ // | 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 | @@ -25,67 +25,106 @@ // | USA. | // +-----------------------------------------------------------------------+ + +/** + * Upgrade from 1.3.0 to 1.3.1 + */ + if (!defined('PHPWG_ROOT_PATH')) { - die('Hacking attempt!'); + die ('This page cannot be loaded directly, load upgrade.php'); +} +else +{ + if (!defined('PHPWG_IN_UPGRADE') or !PHPWG_IN_UPGRADE) + { + die ('Hacking attempt!'); + } } -$upgrade_description = - '#image_category.is_storage replaced by #image.storage_category_id'; +$queries = array( + " +ALTER TABLE phpwebgallery_categories + ADD COLUMN uppercats varchar(255) NOT NULL default '' +;", -// +-----------------------------------------------------------------------+ -// | New column | -// +-----------------------------------------------------------------------+ + " +CREATE TABLE phpwebgallery_user_category ( + user_id smallint(5) unsigned NOT NULL default '0' +) +;", -$query = ' -ALTER TABLE '.PREFIX_TABLE.'images - ADD storage_category_id smallint(5) unsigned default NULL -;'; -pwg_query($query); + " +ALTER TABLE phpwebgallery_categories + ADD INDEX id (id) +;", + + " +ALTER TABLE phpwebgallery_categories + ADD INDEX id_uppercat (id_uppercat) +;", + + " +ALTER TABLE phpwebgallery_image_category + ADD INDEX category_id (category_id) +;", + + " +ALTER TABLE phpwebgallery_image_category + ADD INDEX image_id (image_id) +;", + ); + +foreach ($queries as $query) +{ + $query = str_replace('phpwebgallery_', PREFIX_TABLE, $query); + pwg_query($query); +} +// filling the new column categories.uppercats +$id_uppercats = array(); $query = ' -SELECT category_id, image_id - FROM '.PREFIX_TABLE.'image_category - WHERE is_storage = \'true\' +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(); -while ($row = mysql_fetch_array($result)) + +foreach (array_keys($id_uppercats) as $id) { - array_push( - $datas, - array( - 'id' => $row['image_id'], - 'storage_category_id' => $row['category_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); } + mass_updates( - PREFIX_TABLE.'images', + CATEGORIES_TABLE, array( 'primary' => array('id'), - 'update' => array('storage_category_id'), + 'update' => array('uppercats') ), $datas ); -// +-----------------------------------------------------------------------+ -// | Delete obsolete column | -// +-----------------------------------------------------------------------+ - -$query = ' -ALTER TABLE '.PREFIX_TABLE.'image_category DROP COLUMN is_storage -;'; -pwg_query($query); - -// +-----------------------------------------------------------------------+ -// | End notification | -// +-----------------------------------------------------------------------+ - -echo -"\n" -.'Column '.PREFIX_TABLE.'image_category' -.' replaced by '.PREFIX_TABLE.'images.storage_category_id'."\n" -; -?> +// now we upgrade from 1.3.1 to 1.6.0 +include_once(PHPWG_ROOT_PATH.'install/upgrade_1.3.1.php'); +?>
\ No newline at end of file |