[1727] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
[2297] | 3 | // | Piwigo - a PHP based picture gallery | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[3046] | 5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
[2297] | 6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
| 7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 10 | // | it under the terms of the GNU General Public License as published by | |
---|
| 11 | // | the Free Software Foundation | |
---|
| 12 | // | | |
---|
| 13 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 16 | // | General Public License for more details. | |
---|
| 17 | // | | |
---|
| 18 | // | You should have received a copy of the GNU General Public License | |
---|
| 19 | // | along with this program; if not, write to the Free Software | |
---|
| 20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 21 | // | USA. | |
---|
| 22 | // +-----------------------------------------------------------------------+ |
---|
[1727] | 23 | |
---|
| 24 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 25 | { |
---|
| 26 | die('Hacking attempt!'); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | $upgrade_description = 'History table new model and new table history_summary'; |
---|
| 30 | |
---|
| 31 | include_once(PHPWG_ROOT_PATH.'include/constants.php'); |
---|
| 32 | |
---|
| 33 | // +-----------------------------------------------------------------------+ |
---|
| 34 | // | Upgrade content | |
---|
| 35 | // +-----------------------------------------------------------------------+ |
---|
| 36 | |
---|
| 37 | echo "Recreate table ".HISTORY_TABLE."\n"; |
---|
| 38 | |
---|
| 39 | $query = 'DROP TABLE '.HISTORY_TABLE.';'; |
---|
| 40 | pwg_query($query); |
---|
| 41 | |
---|
| 42 | $query = " |
---|
| 43 | CREATE TABLE `".HISTORY_TABLE."` ( |
---|
| 44 | `id` int(10) unsigned NOT NULL auto_increment, |
---|
| 45 | `date` date NOT NULL default '0000-00-00', |
---|
| 46 | `time` time NOT NULL default '00:00:00', |
---|
| 47 | `year` smallint(4) NOT NULL default '0', |
---|
| 48 | `month` tinyint(2) NOT NULL default '0', |
---|
| 49 | `day` tinyint(2) NOT NULL default '0', |
---|
| 50 | `hour` tinyint(2) NOT NULL default '0', |
---|
| 51 | `user_id` smallint(5) NOT NULL default '0', |
---|
| 52 | `IP` varchar(15) NOT NULL default '', |
---|
| 53 | `section` enum('categories','tags','search','list','favorites','most_visited','best_rated','recent_pics','recent_cats') default NULL, |
---|
| 54 | `category_id` smallint(5) default NULL, |
---|
| 55 | `tag_ids` varchar(50) default NULL, |
---|
| 56 | `image_id` mediumint(8) default NULL, |
---|
| 57 | `summarized` enum('true','false') default 'false', |
---|
| 58 | PRIMARY KEY (`id`), |
---|
| 59 | KEY `history_i1` (`summarized`) |
---|
| 60 | ) TYPE=MyISAM |
---|
| 61 | ;"; |
---|
| 62 | pwg_query($query); |
---|
| 63 | |
---|
| 64 | echo "Create table ".HISTORY_SUMMARY_TABLE."\n"; |
---|
| 65 | $query = " |
---|
| 66 | CREATE TABLE `".HISTORY_SUMMARY_TABLE."` ( |
---|
| 67 | `id` varchar(13) NOT NULL default '', |
---|
| 68 | `year` smallint(4) NOT NULL default '0', |
---|
| 69 | `month` tinyint(2) default NULL, |
---|
| 70 | `day` tinyint(2) default NULL, |
---|
| 71 | `hour` tinyint(2) default NULL, |
---|
| 72 | `nb_pages` int(11) default NULL, |
---|
| 73 | PRIMARY KEY (`id`) |
---|
| 74 | ) TYPE=MyISAM |
---|
| 75 | ;"; |
---|
| 76 | pwg_query($query); |
---|
| 77 | |
---|
| 78 | echo |
---|
| 79 | "\n" |
---|
| 80 | .'"'.$upgrade_description.'"'.' ended' |
---|
| 81 | ."\n" |
---|
| 82 | ; |
---|
| 83 | |
---|
| 84 | ?> |
---|