From 75ca19864eceaf5c8c706d16ee11559c548347d1 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Aug 2007 05:28:10 +0100 Subject: [PATCH] remove mysql SET CHARACTER SET call --- backend.php | 2 +- mysql_convert_unicode.php | 112 ++++++++++++++++++++++++++++++++++++++ opml.php | 2 +- update.php | 2 +- update_daemon.php | 2 +- update_feeds.php | 2 +- xml-rpc.php | 2 +- 7 files changed, 118 insertions(+), 6 deletions(-) create mode 100644 mysql_convert_unicode.php diff --git a/backend.php b/backend.php index 3783c822..77323008 100644 --- a/backend.php +++ b/backend.php @@ -52,7 +52,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } } diff --git a/mysql_convert_unicode.php b/mysql_convert_unicode.php new file mode 100644 index 00000000..dfc833b4 --- /dev/null +++ b/mysql_convert_unicode.php @@ -0,0 +1,112 @@ + + + + +MySQL Charset Converter + + + + + + + + + + + +

+ + + + "; + + } else if (!$op) { + + print_warning(__("Please backup your database before proceeding.")); + + print "

" . __("This script will convert your Tiny Tiny RSS database to UTF-8. + Depending on current database charset you may experience data corruption (lost accent characters, etc.). + After update, you'll have to set MYSQL_CHARSET option in config.php to 'utf8'.") . "

"; + + print "
+ + +
"; + + } else if ($op == "do") { + + print "

".__("Converting database...")."

"; + + db_query($link, "SET FOREIGN_KEY_CHECKS=0"); + + $result = db_query($link, "SHOW TABLES LIKE 'ttrss%'"); + + while ($line = db_fetch_assoc($result)) { + $vals = array_values($line); + $table = $vals[0]; + + $query = "ALTER TABLE $table CONVERT TO + CHARACTER SET 'utf8'"; + + print "

$query

"; + + db_query($link, $query); + } + + db_query($link, "SET FOREIGN_KEY_CHECKS=1"); + + print "
+ +
"; + + } + +?> + + + + diff --git a/opml.php b/opml.php index ce7b490b..883ddd0d 100644 --- a/opml.php +++ b/opml.php @@ -16,7 +16,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } } diff --git a/update.php b/update.php index f05fefcc..f59f9ef3 100644 --- a/update.php +++ b/update.php @@ -16,7 +16,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } } diff --git a/update_daemon.php b/update_daemon.php index e7f1f401..ce5d2535 100644 --- a/update_daemon.php +++ b/update_daemon.php @@ -68,7 +68,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } } diff --git a/update_feeds.php b/update_feeds.php index 9a1b8f43..a6956dfa 100644 --- a/update_feeds.php +++ b/update_feeds.php @@ -29,7 +29,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } } diff --git a/xml-rpc.php b/xml-rpc.php index affb09d0..07f423cb 100644 --- a/xml-rpc.php +++ b/xml-rpc.php @@ -25,7 +25,7 @@ } else { if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) { db_query($link, "SET NAMES " . MYSQL_CHARSET); - db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); +// db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET); } }