From 77fd1f51a3c5f5a52f72ef8a299fe368228e2285 Mon Sep 17 00:00:00 2001 From: vdigital Date: Fri, 23 May 2008 21:05:41 +0000 Subject: git-svn-id: http://piwigo.org/svn/trunk@2357 68402e56-0260-453c-a942-63ccdbb3a9ee --- BSF/install/db/1-database.php | 42 ++++++ BSF/install/db/10-database.php | 52 +++++++ BSF/install/db/11-database.php | 65 +++++++++ BSF/install/db/12-database.php | 99 +++++++++++++ BSF/install/db/13-database.php | 69 +++++++++ BSF/install/db/14-database.php | 59 ++++++++ BSF/install/db/15-database.php | 46 ++++++ BSF/install/db/16-database.php | 50 +++++++ BSF/install/db/17-database.php | 60 ++++++++ BSF/install/db/18-database.php | 88 ++++++++++++ BSF/install/db/19-database.php | 149 +++++++++++++++++++ BSF/install/db/2-database.php | 74 ++++++++++ BSF/install/db/20-database.php | 87 +++++++++++ BSF/install/db/21-database.php | 48 +++++++ BSF/install/db/22-database.php | 54 +++++++ BSF/install/db/23-database.php | 46 ++++++ BSF/install/db/24-database.php | 46 ++++++ BSF/install/db/25-database.php | 47 ++++++ BSF/install/db/26-database.php | 43 ++++++ BSF/install/db/27-database.php | 43 ++++++ BSF/install/db/28-database.php | 42 ++++++ BSF/install/db/29-database.php | 42 ++++++ BSF/install/db/3-database.php | 53 +++++++ BSF/install/db/30-database.php | 50 +++++++ BSF/install/db/31-database.php | 43 ++++++ BSF/install/db/32-database.php | 43 ++++++ BSF/install/db/33-database.php | 51 +++++++ BSF/install/db/34-database.php | 56 ++++++++ BSF/install/db/35-database.php | 58 ++++++++ BSF/install/db/36-database.php | 43 ++++++ BSF/install/db/37-database.php | 63 ++++++++ BSF/install/db/38-database.php | 46 ++++++ BSF/install/db/39-database.php | 40 ++++++ BSF/install/db/4-database.php | 50 +++++++ BSF/install/db/40-database.php | 40 ++++++ BSF/install/db/41-database.php | 61 ++++++++ BSF/install/db/42-database.php | 84 +++++++++++ BSF/install/db/43-database.php | 47 ++++++ BSF/install/db/44-database.php | 47 ++++++ BSF/install/db/45-database.php | 48 +++++++ BSF/install/db/46-database.php | 46 ++++++ BSF/install/db/47-database.php | 52 +++++++ BSF/install/db/48-database.php | 48 +++++++ BSF/install/db/49-database.php | 54 +++++++ BSF/install/db/5-database.php | 46 ++++++ BSF/install/db/50-database.php | 50 +++++++ BSF/install/db/51-database.php | 57 ++++++++ BSF/install/db/52-database.php | 69 +++++++++ BSF/install/db/53-database.php | 57 ++++++++ BSF/install/db/54-database.php | 69 +++++++++ BSF/install/db/55-database.php | 59 ++++++++ BSF/install/db/56-database.php | 49 +++++++ BSF/install/db/57-database.php | 63 ++++++++ BSF/install/db/58-database.php | 48 +++++++ BSF/install/db/59-database.php | 79 ++++++++++ BSF/install/db/6-database.php | 53 +++++++ BSF/install/db/60-database.php | 86 +++++++++++ BSF/install/db/61-database.php | 50 +++++++ BSF/install/db/62-database.php | 48 +++++++ BSF/install/db/63-database.php | 73 ++++++++++ BSF/install/db/64-database.php | 50 +++++++ BSF/install/db/65-database.php | 319 +++++++++++++++++++++++++++++++++++++++++ BSF/install/db/66-database.php | 48 +++++++ BSF/install/db/67-database.php | 48 +++++++ BSF/install/db/68-database.php | 55 +++++++ BSF/install/db/69-database.php | 58 ++++++++ BSF/install/db/7-database.php | 65 +++++++++ BSF/install/db/70-database.php | 53 +++++++ BSF/install/db/71-database.php | 58 ++++++++ BSF/install/db/8-database.php | 83 +++++++++++ BSF/install/db/9-database.php | 86 +++++++++++ BSF/install/db/index.php | 30 ++++ 72 files changed, 4383 insertions(+) create mode 100644 BSF/install/db/1-database.php create mode 100644 BSF/install/db/10-database.php create mode 100644 BSF/install/db/11-database.php create mode 100644 BSF/install/db/12-database.php create mode 100644 BSF/install/db/13-database.php create mode 100644 BSF/install/db/14-database.php create mode 100644 BSF/install/db/15-database.php create mode 100644 BSF/install/db/16-database.php create mode 100644 BSF/install/db/17-database.php create mode 100644 BSF/install/db/18-database.php create mode 100644 BSF/install/db/19-database.php create mode 100644 BSF/install/db/2-database.php create mode 100644 BSF/install/db/20-database.php create mode 100644 BSF/install/db/21-database.php create mode 100644 BSF/install/db/22-database.php create mode 100644 BSF/install/db/23-database.php create mode 100644 BSF/install/db/24-database.php create mode 100644 BSF/install/db/25-database.php create mode 100644 BSF/install/db/26-database.php create mode 100644 BSF/install/db/27-database.php create mode 100644 BSF/install/db/28-database.php create mode 100644 BSF/install/db/29-database.php create mode 100644 BSF/install/db/3-database.php create mode 100644 BSF/install/db/30-database.php create mode 100644 BSF/install/db/31-database.php create mode 100644 BSF/install/db/32-database.php create mode 100644 BSF/install/db/33-database.php create mode 100644 BSF/install/db/34-database.php create mode 100644 BSF/install/db/35-database.php create mode 100644 BSF/install/db/36-database.php create mode 100644 BSF/install/db/37-database.php create mode 100644 BSF/install/db/38-database.php create mode 100644 BSF/install/db/39-database.php create mode 100644 BSF/install/db/4-database.php create mode 100644 BSF/install/db/40-database.php create mode 100644 BSF/install/db/41-database.php create mode 100644 BSF/install/db/42-database.php create mode 100644 BSF/install/db/43-database.php create mode 100644 BSF/install/db/44-database.php create mode 100644 BSF/install/db/45-database.php create mode 100644 BSF/install/db/46-database.php create mode 100644 BSF/install/db/47-database.php create mode 100644 BSF/install/db/48-database.php create mode 100644 BSF/install/db/49-database.php create mode 100644 BSF/install/db/5-database.php create mode 100644 BSF/install/db/50-database.php create mode 100644 BSF/install/db/51-database.php create mode 100644 BSF/install/db/52-database.php create mode 100644 BSF/install/db/53-database.php create mode 100644 BSF/install/db/54-database.php create mode 100644 BSF/install/db/55-database.php create mode 100644 BSF/install/db/56-database.php create mode 100644 BSF/install/db/57-database.php create mode 100644 BSF/install/db/58-database.php create mode 100644 BSF/install/db/59-database.php create mode 100644 BSF/install/db/6-database.php create mode 100644 BSF/install/db/60-database.php create mode 100644 BSF/install/db/61-database.php create mode 100644 BSF/install/db/62-database.php create mode 100644 BSF/install/db/63-database.php create mode 100644 BSF/install/db/64-database.php create mode 100644 BSF/install/db/65-database.php create mode 100644 BSF/install/db/66-database.php create mode 100644 BSF/install/db/67-database.php create mode 100644 BSF/install/db/68-database.php create mode 100644 BSF/install/db/69-database.php create mode 100644 BSF/install/db/7-database.php create mode 100644 BSF/install/db/70-database.php create mode 100644 BSF/install/db/71-database.php create mode 100644 BSF/install/db/8-database.php create mode 100644 BSF/install/db/9-database.php create mode 100644 BSF/install/db/index.php (limited to 'BSF/install/db') diff --git a/BSF/install/db/1-database.php b/BSF/install/db/1-database.php new file mode 100644 index 000000000..5cc4ac96f --- /dev/null +++ b/BSF/install/db/1-database.php @@ -0,0 +1,42 @@ + diff --git a/BSF/install/db/10-database.php b/BSF/install/db/10-database.php new file mode 100644 index 000000000..47b9a17f1 --- /dev/null +++ b/BSF/install/db/10-database.php @@ -0,0 +1,52 @@ + diff --git a/BSF/install/db/11-database.php b/BSF/install/db/11-database.php new file mode 100644 index 000000000..c4b3a485c --- /dev/null +++ b/BSF/install/db/11-database.php @@ -0,0 +1,65 @@ + diff --git a/BSF/install/db/12-database.php b/BSF/install/db/12-database.php new file mode 100644 index 000000000..b63495276 --- /dev/null +++ b/BSF/install/db/12-database.php @@ -0,0 +1,99 @@ + $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/BSF/install/db/13-database.php b/BSF/install/db/13-database.php new file mode 100644 index 000000000..d6df66fad --- /dev/null +++ b/BSF/install/db/13-database.php @@ -0,0 +1,69 @@ +

'.$t.'

'.$d.'

'; +$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/BSF/install/db/14-database.php b/BSF/install/db/14-database.php new file mode 100644 index 000000000..596673814 --- /dev/null +++ b/BSF/install/db/14-database.php @@ -0,0 +1,59 @@ + '".$conf['newuser_default_enabled_high']."' +;"; +pwg_query($query); + +echo +"\n" +.'"'.$upgrade_description.'"'.' ended' +."\n" +; + +?> diff --git a/BSF/install/db/15-database.php b/BSF/install/db/15-database.php new file mode 100644 index 000000000..0b393d629 --- /dev/null +++ b/BSF/install/db/15-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/16-database.php b/BSF/install/db/16-database.php new file mode 100644 index 000000000..ad7a49883 --- /dev/null +++ b/BSF/install/db/16-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/17-database.php b/BSF/install/db/17-database.php new file mode 100644 index 000000000..d707c55d1 --- /dev/null +++ b/BSF/install/db/17-database.php @@ -0,0 +1,60 @@ + diff --git a/BSF/install/db/18-database.php b/BSF/install/db/18-database.php new file mode 100644 index 000000000..52aa0e9fa --- /dev/null +++ b/BSF/install/db/18-database.php @@ -0,0 +1,88 @@ + $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/BSF/install/db/19-database.php b/BSF/install/db/19-database.php new file mode 100644 index 000000000..e26b502f7 --- /dev/null +++ b/BSF/install/db/19-database.php @@ -0,0 +1,149 @@ + $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/BSF/install/db/2-database.php b/BSF/install/db/2-database.php new file mode 100644 index 000000000..14c4cbfc2 --- /dev/null +++ b/BSF/install/db/2-database.php @@ -0,0 +1,74 @@ + diff --git a/BSF/install/db/20-database.php b/BSF/install/db/20-database.php new file mode 100644 index 000000000..4561e44ec --- /dev/null +++ b/BSF/install/db/20-database.php @@ -0,0 +1,87 @@ + $row['image_id'], + 'storage_category_id' => $row['category_id'], + ) + ); +} +mass_updates( + PREFIX_TABLE.'images', + array( + 'primary' => array('id'), + 'update' => array('storage_category_id'), + ), + $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" +; +?> diff --git a/BSF/install/db/21-database.php b/BSF/install/db/21-database.php new file mode 100644 index 000000000..743bbcbe6 --- /dev/null +++ b/BSF/install/db/21-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/22-database.php b/BSF/install/db/22-database.php new file mode 100644 index 000000000..a402b57d1 --- /dev/null +++ b/BSF/install/db/22-database.php @@ -0,0 +1,54 @@ + diff --git a/BSF/install/db/23-database.php b/BSF/install/db/23-database.php new file mode 100644 index 000000000..78b0fe2a3 --- /dev/null +++ b/BSF/install/db/23-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/24-database.php b/BSF/install/db/24-database.php new file mode 100644 index 000000000..21467fd7b --- /dev/null +++ b/BSF/install/db/24-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/25-database.php b/BSF/install/db/25-database.php new file mode 100644 index 000000000..9afa5e5ac --- /dev/null +++ b/BSF/install/db/25-database.php @@ -0,0 +1,47 @@ +Piwigo demonstration site

My photos web site

\' + WHERE param = \'page_banner\' +;'; +pwg_query($query); + +// +-----------------------------------------------------------------------+ +// | End notification | +// +-----------------------------------------------------------------------+ + +echo +"\n" +.$upgrade_description +."\n" +; +?> diff --git a/BSF/install/db/26-database.php b/BSF/install/db/26-database.php new file mode 100644 index 000000000..9e614f5d5 --- /dev/null +++ b/BSF/install/db/26-database.php @@ -0,0 +1,43 @@ + diff --git a/BSF/install/db/27-database.php b/BSF/install/db/27-database.php new file mode 100644 index 000000000..600002550 --- /dev/null +++ b/BSF/install/db/27-database.php @@ -0,0 +1,43 @@ + diff --git a/BSF/install/db/28-database.php b/BSF/install/db/28-database.php new file mode 100644 index 000000000..93758cbba --- /dev/null +++ b/BSF/install/db/28-database.php @@ -0,0 +1,42 @@ + diff --git a/BSF/install/db/29-database.php b/BSF/install/db/29-database.php new file mode 100644 index 000000000..04f65c0cb --- /dev/null +++ b/BSF/install/db/29-database.php @@ -0,0 +1,42 @@ + diff --git a/BSF/install/db/3-database.php b/BSF/install/db/3-database.php new file mode 100644 index 000000000..3a53f27a8 --- /dev/null +++ b/BSF/install/db/3-database.php @@ -0,0 +1,53 @@ + diff --git a/BSF/install/db/30-database.php b/BSF/install/db/30-database.php new file mode 100644 index 000000000..d6442965c --- /dev/null +++ b/BSF/install/db/30-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/31-database.php b/BSF/install/db/31-database.php new file mode 100644 index 000000000..1463a826f --- /dev/null +++ b/BSF/install/db/31-database.php @@ -0,0 +1,43 @@ + diff --git a/BSF/install/db/32-database.php b/BSF/install/db/32-database.php new file mode 100644 index 000000000..72990ff76 --- /dev/null +++ b/BSF/install/db/32-database.php @@ -0,0 +1,43 @@ + diff --git a/BSF/install/db/33-database.php b/BSF/install/db/33-database.php new file mode 100644 index 000000000..2f771a62f --- /dev/null +++ b/BSF/install/db/33-database.php @@ -0,0 +1,51 @@ + diff --git a/BSF/install/db/34-database.php b/BSF/install/db/34-database.php new file mode 100644 index 000000000..95092b074 --- /dev/null +++ b/BSF/install/db/34-database.php @@ -0,0 +1,56 @@ + diff --git a/BSF/install/db/35-database.php b/BSF/install/db/35-database.php new file mode 100644 index 000000000..8b9e4448f --- /dev/null +++ b/BSF/install/db/35-database.php @@ -0,0 +1,58 @@ + diff --git a/BSF/install/db/36-database.php b/BSF/install/db/36-database.php new file mode 100644 index 000000000..e1eccbe3b --- /dev/null +++ b/BSF/install/db/36-database.php @@ -0,0 +1,43 @@ + diff --git a/BSF/install/db/37-database.php b/BSF/install/db/37-database.php new file mode 100644 index 000000000..05362e33a --- /dev/null +++ b/BSF/install/db/37-database.php @@ -0,0 +1,63 @@ + diff --git a/BSF/install/db/38-database.php b/BSF/install/db/38-database.php new file mode 100644 index 000000000..ff9a3e788 --- /dev/null +++ b/BSF/install/db/38-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/39-database.php b/BSF/install/db/39-database.php new file mode 100644 index 000000000..7adc8be61 --- /dev/null +++ b/BSF/install/db/39-database.php @@ -0,0 +1,40 @@ + diff --git a/BSF/install/db/4-database.php b/BSF/install/db/4-database.php new file mode 100644 index 000000000..5385575b9 --- /dev/null +++ b/BSF/install/db/4-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/40-database.php b/BSF/install/db/40-database.php new file mode 100644 index 000000000..bc5543f0d --- /dev/null +++ b/BSF/install/db/40-database.php @@ -0,0 +1,40 @@ + diff --git a/BSF/install/db/41-database.php b/BSF/install/db/41-database.php new file mode 100644 index 000000000..6810fbad1 --- /dev/null +++ b/BSF/install/db/41-database.php @@ -0,0 +1,61 @@ + diff --git a/BSF/install/db/42-database.php b/BSF/install/db/42-database.php new file mode 100644 index 000000000..12d40b140 --- /dev/null +++ b/BSF/install/db/42-database.php @@ -0,0 +1,84 @@ + diff --git a/BSF/install/db/43-database.php b/BSF/install/db/43-database.php new file mode 100644 index 000000000..cc50f4a50 --- /dev/null +++ b/BSF/install/db/43-database.php @@ -0,0 +1,47 @@ + diff --git a/BSF/install/db/44-database.php b/BSF/install/db/44-database.php new file mode 100644 index 000000000..45f98f06e --- /dev/null +++ b/BSF/install/db/44-database.php @@ -0,0 +1,47 @@ + diff --git a/BSF/install/db/45-database.php b/BSF/install/db/45-database.php new file mode 100644 index 000000000..79221ae35 --- /dev/null +++ b/BSF/install/db/45-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/46-database.php b/BSF/install/db/46-database.php new file mode 100644 index 000000000..07e9e9d53 --- /dev/null +++ b/BSF/install/db/46-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/47-database.php b/BSF/install/db/47-database.php new file mode 100644 index 000000000..e5248187b --- /dev/null +++ b/BSF/install/db/47-database.php @@ -0,0 +1,52 @@ + diff --git a/BSF/install/db/48-database.php b/BSF/install/db/48-database.php new file mode 100644 index 000000000..888d2f8ee --- /dev/null +++ b/BSF/install/db/48-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/49-database.php b/BSF/install/db/49-database.php new file mode 100644 index 000000000..50f04bcc1 --- /dev/null +++ b/BSF/install/db/49-database.php @@ -0,0 +1,54 @@ + diff --git a/BSF/install/db/5-database.php b/BSF/install/db/5-database.php new file mode 100644 index 000000000..d7c8d6903 --- /dev/null +++ b/BSF/install/db/5-database.php @@ -0,0 +1,46 @@ + diff --git a/BSF/install/db/50-database.php b/BSF/install/db/50-database.php new file mode 100644 index 000000000..ee7589e84 --- /dev/null +++ b/BSF/install/db/50-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/51-database.php b/BSF/install/db/51-database.php new file mode 100644 index 000000000..6ccac09a6 --- /dev/null +++ b/BSF/install/db/51-database.php @@ -0,0 +1,57 @@ + diff --git a/BSF/install/db/52-database.php b/BSF/install/db/52-database.php new file mode 100644 index 000000000..fb5a117d2 --- /dev/null +++ b/BSF/install/db/52-database.php @@ -0,0 +1,69 @@ + diff --git a/BSF/install/db/53-database.php b/BSF/install/db/53-database.php new file mode 100644 index 000000000..2618bd41e --- /dev/null +++ b/BSF/install/db/53-database.php @@ -0,0 +1,57 @@ +'), + array('&', '&') // <- this must be the last one + ); + +foreach ($replacements as $replacement) +{ + $query = ' +UPDATE '.COMMENTS_TABLE.' + SET content = REPLACE(content, "'.addslashes($replacement[0]).'", "'.addslashes($replacement[1]).'") +;'; + pwg_query($query); +} + +echo +"\n" +.'"'.$upgrade_description.'"'.', ended' +."\n" +; + +?> diff --git a/BSF/install/db/54-database.php b/BSF/install/db/54-database.php new file mode 100644 index 000000000..332b556f8 --- /dev/null +++ b/BSF/install/db/54-database.php @@ -0,0 +1,69 @@ + diff --git a/BSF/install/db/55-database.php b/BSF/install/db/55-database.php new file mode 100644 index 000000000..72d85c5f3 --- /dev/null +++ b/BSF/install/db/55-database.php @@ -0,0 +1,59 @@ + diff --git a/BSF/install/db/56-database.php b/BSF/install/db/56-database.php new file mode 100644 index 000000000..05837b217 --- /dev/null +++ b/BSF/install/db/56-database.php @@ -0,0 +1,49 @@ + diff --git a/BSF/install/db/57-database.php b/BSF/install/db/57-database.php new file mode 100644 index 000000000..ba760f4e1 --- /dev/null +++ b/BSF/install/db/57-database.php @@ -0,0 +1,63 @@ + diff --git a/BSF/install/db/58-database.php b/BSF/install/db/58-database.php new file mode 100644 index 000000000..c7a5b77a3 --- /dev/null +++ b/BSF/install/db/58-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/59-database.php b/BSF/install/db/59-database.php new file mode 100644 index 000000000..adcbbb3e3 --- /dev/null +++ b/BSF/install/db/59-database.php @@ -0,0 +1,79 @@ + \ No newline at end of file diff --git a/BSF/install/db/6-database.php b/BSF/install/db/6-database.php new file mode 100644 index 000000000..cc21c009e --- /dev/null +++ b/BSF/install/db/6-database.php @@ -0,0 +1,53 @@ + diff --git a/BSF/install/db/60-database.php b/BSF/install/db/60-database.php new file mode 100644 index 000000000..cc5d8ccfb --- /dev/null +++ b/BSF/install/db/60-database.php @@ -0,0 +1,86 @@ + diff --git a/BSF/install/db/61-database.php b/BSF/install/db/61-database.php new file mode 100644 index 000000000..83090473a --- /dev/null +++ b/BSF/install/db/61-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/62-database.php b/BSF/install/db/62-database.php new file mode 100644 index 000000000..18d2d7fa8 --- /dev/null +++ b/BSF/install/db/62-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/63-database.php b/BSF/install/db/63-database.php new file mode 100644 index 000000000..69e6dd972 --- /dev/null +++ b/BSF/install/db/63-database.php @@ -0,0 +1,73 @@ + diff --git a/BSF/install/db/64-database.php b/BSF/install/db/64-database.php new file mode 100644 index 000000000..37dca478f --- /dev/null +++ b/BSF/install/db/64-database.php @@ -0,0 +1,50 @@ + diff --git a/BSF/install/db/65-database.php b/BSF/install/db/65-database.php new file mode 100644 index 000000000..daa59de30 --- /dev/null +++ b/BSF/install/db/65-database.php @@ -0,0 +1,319 @@ + 'varbinary', + 'text' => 'blob', + 'mediumtext' => 'mediumblob', + 'longtext' => 'longblob'); + + $changes=array(); + foreach( $field_definitions as $row) + { + if ( !isset($row['Collation']) or $row['Collation']=='NULL' ) + continue; + list ($type) = explode('(', $row['Type']); + if (!isset($types[$type])) + continue; // no need + $binaryType = preg_replace('/'. $type .'/i', $types[$type], $row['Type'] ); + $changes[] = 'MODIFY COLUMN '.$row['Field'].' '.$binaryType; + } + if (count($changes)) + { + $query = 'ALTER TABLE '.$table.' '.implode(', ', $changes); + pwg_query($query); + } +} + +function upgrade65_change_table_to_charset($table, $field_definitions, $db_charset) +{ + $changes=array(); + foreach( $field_definitions as $row) + { + if ( !isset($row['Collation']) or $row['Collation']=='NULL' ) + continue; + $query = $row['Field'].' '.$row['Type']; + $query .= ' CHARACTER SET '.$db_charset; + if (strpos($row['Collation'],'_bin')!==false) + { + $query .= ' BINARY'; + } + if ($row['Null']!='YES') + { + $query.=' NOT NULL'; + if (isset($row['Default'])) + $query.=' DEFAULT "'.addslashes($row['Default']).'"'; + } + else + { + if (!isset($row['Default'])) + $query.=' DEFAULT NULL'; + else + $query.=' DEFAULT "'.addslashes($row['Default']).'"'; + } + + if ($row['Extra']=='auto_increment') + { + $query.=' auto_increment'; + } + $changes[] = 'MODIFY COLUMN '.$query; + } + + if (count($changes)) + { + $query = 'ALTER TABLE `'.$table.'` '.implode(', ', $changes); + pwg_query($query); + } +} + + +$upgrade_description = 'PWG charset migration'; +// +-----------------------------------------------------------------------+ +// | Upgrade content | +// +-----------------------------------------------------------------------+ +if ( !defined('PWG_CHARSET') ) +{ + $upgrade_log = ''; + +// +-----------------------------------------------------------------------+ +// load the config file + $config_file = PHPWG_ROOT_PATH.'include/mysql.inc.php'; + $config_file_contents = @file_get_contents($config_file); + if ($config_file_contents === false) + { + die('CANNOT LOAD '.$config_file); + } + $php_end_tag = strrpos($config_file_contents, '?'.'>'); + if ($php_end_tag === false) + { + die('CANNOT FIND PHP END TAG IN '.$config_file); + } + if (!is_writable($config_file)) + { + die('FILE NOT WRITABLE '.$config_file); + } + + +// +-----------------------------------------------------------------------+ +// load all the user languages + $all_langs=array(); + $query=' +SELECT language, COUNT(user_id) AS count FROM '.USER_INFOS_TABLE.' + GROUP BY language'; + $result = pwg_query($query); + while ( $row=mysql_fetch_assoc($result) ) + { + $lang = $row["language"]; + $lang_def = explode('.', $lang); + if ( count($lang_def)==2 ) + { + $new_lang = $lang_def[0]; + $charset = strtolower($lang_def[1]); + } + else + { + $new_lang = 'en_UK'; + $charset = 'iso-8859-1'; + } + $all_langs[$lang] = array( + 'count' => $row['count'], + 'new_lang' => $new_lang, + 'charset' => $charset, + ); + $upgrade_log .= ">>user_lang\t".$lang."\t".$row['count']."\n"; + } + $upgrade_log .= "\n"; + + +// +-----------------------------------------------------------------------+ +// get admin charset + include(PHPWG_ROOT_PATH . 'include/config_default.inc.php'); + @include(PHPWG_ROOT_PATH. 'include/config_local.inc.php'); + $admin_charset='iso-8859-1'; + $query=' +SELECT language FROM '.USER_INFOS_TABLE.' + WHERE user_id='.$conf['webmaster_id']; + $result = pwg_query($query); + if (mysql_num_rows($result)==0) + { + $query=' +SELECT language FROM '.USER_INFOS_TABLE.' + WHERE status="webmaster" and adviser="false" + LIMIT 1'; + $result = pwg_query($query); + } + + if ( $row=mysql_fetch_assoc($result) ) + { + $admin_charset = $all_langs[$row['language']]['charset']; + } + $upgrade_log .= ">>admin_charset\t".$admin_charset."\n"; + + +// +-----------------------------------------------------------------------+ +// get mysql version and structure of tables + $mysql_version = mysql_get_server_info(); + $upgrade_log .= ">>mysql_ver\t".$mysql_version."\n"; + + $all_tables = array(); + $query = 'SHOW TABLES LIKE "'.$prefixeTable.'%"'; + $result = pwg_query($query); + while ( $row=mysql_fetch_array($result) ) + { + array_push($all_tables, $row[0]); + } + + $all_tables_definition = array(); + foreach( $all_tables as $table) + { + $query = 'SHOW FULL COLUMNS FROM '.$table; + $result = pwg_query($query); + $field_definitions=array(); + while ( $row=mysql_fetch_array($result) ) + { + if ( !isset($row['Collation']) or $row['Collation']=='NULL' ) + continue; + array_push($field_definitions, $row); + } + $all_tables_definition[$table] = $field_definitions; + } + +// +-----------------------------------------------------------------------+ +// calculate the result and convert the tables + +//tables that can be converted without going through binary (they contain only ascii data) + $safe_tables=array('history','history_backup','history_summary','old_permalinks','plugins','rate','upgrade','user_cache','user_feed','user_infos','user_mail_notification', 'users', 'waiting','ws_access'); + $safe_tables=array_flip($safe_tables); + + $pwg_charset = 'iso-8859-1'; + $db_charset = 'latin1'; + $db_collate = ''; + if ( version_compare($mysql_version, '4.1', '<') ) + { // below 4.1 no charset support + $upgrade_log .= "< conversion\tnothing\n"; + } + elseif ($admin_charset=='iso-8859-1') + { + $pwg_charset = 'utf-8'; + $db_charset = 'utf8'; + foreach($all_tables as $table) + { + upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' ); + $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8'; + pwg_query($query); + } + $upgrade_log .= "< conversion\tchange utf8\n"; + } +/*ALTER TABLE tbl_name CONVERT TO CHARACTER SET charset_name; (or change column character set) + +Warning: The preceding operation converts column values between the character sets. This is not what you want if you have a column in one character set (like latin1) but the stored values actually use some other, incompatible character set (like utf8). In this case, you have to do the following for each such column: + +ALTER TABLE t1 CHANGE c1 c1 BLOB; +ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET utf8; +*/ + elseif ( $admin_charset=='utf-8') + { + $pwg_charset = 'utf-8'; + $db_charset = 'utf8'; + foreach($all_tables as $table) + { + if ( !isset($safe_tables[ substr($table, strlen($prefixeTable)) ]) ) + upgrade65_change_table_to_blob($table, $all_tables_definition[$table] ); + upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' ); + $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8'; + pwg_query($query); + } + $upgrade_log .= "< conversion\tchange binary\n"; + $upgrade_log .= "< conversion\tchange utf8\n"; + } + elseif ( $admin_charset=='iso-8859-2'/*Central European*/) + { + $pwg_charset = 'utf-8'; + $db_charset = 'utf8'; + foreach($all_tables as $table) + { + if ( !isset($safe_tables[ substr($table, strlen($prefixeTable)) ]) ) + { + upgrade65_change_table_to_blob($table, $all_tables_definition[$table] ); + upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'latin2' ); + } + upgrade65_change_table_to_charset($table, $all_tables_definition[$table], 'utf8' ); + $query = 'ALTER TABLE '.$table.' DEFAULT CHARACTER SET utf8'; + pwg_query($query); + } + $upgrade_log .= "< conversion\tchange binary\n"; + $upgrade_log .= "< conversion\tchange latin2\n"; + $upgrade_log .= "< conversion\tchange utf8\n"; + } + + +// +-----------------------------------------------------------------------+ +// write the result to file and update #user_infos.language + $config_file_contents = + substr($config_file_contents, 0, $php_end_tag).' +define(\'PWG_CHARSET\', \''.$pwg_charset.'\'); +define(\'DB_CHARSET\', \''.$db_charset.'\'); +define(\'DB_COLLATE\', \'\'); +'.substr($config_file_contents, $php_end_tag); + + $fp = @fopen( $config_file, 'w' ); + @fputs($fp, $config_file_contents, strlen($config_file_contents)); + @fclose($fp); + + foreach ($all_langs as $old_lang=>$lang_data) + { + $query=' + UPDATE '.USER_INFOS_TABLE.' SET language="'.$lang_data['new_lang'].'" + WHERE language="'.$old_lang.'"'; + pwg_query($query); + } + + define('PWG_CHARSET', $pwg_charset); + define('DB_CHARSET', $db_charset); + define('DB_COLLATE', ''); + + echo $upgrade_log; + $fp = @fopen( PHPWG_ROOT_PATH.'upgrade65.log', 'w' ); + if ($fp) + { + @fputs($fp, $upgrade_log, strlen($upgrade_log)); + @fclose($fp); + } + +echo +"\n" +.'"'.$upgrade_description.'"'.' ended' +."\n" +; +} +else +{ + echo 'PWG_CHARSET already defined - nada'; +} +?> diff --git a/BSF/install/db/66-database.php b/BSF/install/db/66-database.php new file mode 100644 index 000000000..d6a861ae2 --- /dev/null +++ b/BSF/install/db/66-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/67-database.php b/BSF/install/db/67-database.php new file mode 100644 index 000000000..993f5dd21 --- /dev/null +++ b/BSF/install/db/67-database.php @@ -0,0 +1,48 @@ + diff --git a/BSF/install/db/68-database.php b/BSF/install/db/68-database.php new file mode 100644 index 000000000..39283a7a2 --- /dev/null +++ b/BSF/install/db/68-database.php @@ -0,0 +1,55 @@ + diff --git a/BSF/install/db/69-database.php b/BSF/install/db/69-database.php new file mode 100644 index 000000000..dad302401 --- /dev/null +++ b/BSF/install/db/69-database.php @@ -0,0 +1,58 @@ + diff --git a/BSF/install/db/7-database.php b/BSF/install/db/7-database.php new file mode 100644 index 000000000..d6f37e164 --- /dev/null +++ b/BSF/install/db/7-database.php @@ -0,0 +1,65 @@ + diff --git a/BSF/install/db/70-database.php b/BSF/install/db/70-database.php new file mode 100644 index 000000000..50dfc161b --- /dev/null +++ b/BSF/install/db/70-database.php @@ -0,0 +1,53 @@ + diff --git a/BSF/install/db/71-database.php b/BSF/install/db/71-database.php new file mode 100644 index 000000000..ef453509f --- /dev/null +++ b/BSF/install/db/71-database.php @@ -0,0 +1,58 @@ + diff --git a/BSF/install/db/8-database.php b/BSF/install/db/8-database.php new file mode 100644 index 000000000..5971ef8ea --- /dev/null +++ b/BSF/install/db/8-database.php @@ -0,0 +1,83 @@ + 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/BSF/install/db/9-database.php b/BSF/install/db/9-database.php new file mode 100644 index 000000000..2a8c0034a --- /dev/null +++ b/BSF/install/db/9-database.php @@ -0,0 +1,86 @@ + $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/BSF/install/db/index.php b/BSF/install/db/index.php new file mode 100644 index 000000000..c15b15795 --- /dev/null +++ b/BSF/install/db/index.php @@ -0,0 +1,30 @@ + -- cgit v1.2.3