]> git.wh0rd.org - tt-rss.git/commitdiff
remove mysql SET CHARACTER SET call
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 25 Aug 2007 04:28:10 +0000 (05:28 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 25 Aug 2007 04:28:10 +0000 (05:28 +0100)
backend.php
mysql_convert_unicode.php [new file with mode: 0644]
opml.php
update.php
update_daemon.php
update_feeds.php
xml-rpc.php

index 3783c82266b3206951d8b5ad9208ce6b3d7b9902..77323008fce5b9042d37120239a364413083f468 100644 (file)
@@ -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 (file)
index 0000000..dfc833b
--- /dev/null
@@ -0,0 +1,112 @@
+<?php
+       error_reporting(E_ERROR | E_WARNING | E_PARSE);
+
+       require_once "sessions.php";
+       
+       require_once "sanity_check.php";
+       require_once "functions.php";
+       require_once "config.php";
+       require_once "db.php";
+       
+       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
+       
+       if (DB_TYPE == "pgsql") {
+               pg_query($link, "set client_encoding = 'utf-8'");
+               pg_set_client_encoding("UNICODE");
+       } else {
+               if (defined('MYSQL_CHARSET') && MYSQL_CHARSET) {
+                       db_query($link, "SET NAMES " . MYSQL_CHARSET);
+//                     db_query($link, "SET CHARACTER SET " . MYSQL_CHARSET);
+               }
+       }
+
+       login_sequence($link);
+       
+       $owner_uid = $_SESSION["uid"];
+       
+       if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { 
+               $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
+               render_login_form($link);
+               exit;
+       }
+
+
+?>
+
+<html>
+<head>
+<title>MySQL Charset Converter</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<link rel="stylesheet" type="text/css" href="utility.css">
+<script type="text/javascript" src="localized_js.php"></script>
+</head>
+
+<body>
+
+<script type='text/javascript'>
+function confirmOP() {
+       return confirm(__("Update the database?"));
+}
+</script>
+
+<div class="floatingLogo"><img src="images/ttrss_logo.png"></div>
+
+<h1><?php echo __("MySQL Charset Updater") ?></h1>
+
+<?php
+
+       $op = $_POST["op"];
+
+       if (DB_TYPE != "mysql") {
+               print_warning(__("This script is for Tiny Tiny RSS installations with MySQL backend only."));
+
+               print "<form method=\"GET\" action=\"logout.php\">
+                       <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                       </form>";
+
+       } else if (!$op) {
+
+               print_warning(__("Please backup your database before proceeding."));
+
+               print "<p>" . __("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 <b>MYSQL_CHARSET</b> option in config.php to 'utf8'.") . "</p>";
+       
+               print "<form method='POST'>
+                       <input type='hidden' name='op' value='do'>
+                       <input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'>
+                       </form>";
+       
+       } else if ($op == "do") {
+       
+               print "<p>".__("Converting database...")."</p>";
+
+               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 "<p class='query'>$query</p>";
+
+                       db_query($link, $query);
+               }
+
+               db_query($link, "SET FOREIGN_KEY_CHECKS=1");
+
+               print "<form method=\"GET\" action=\"logout.php\">
+                       <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
+                       </form>";
+
+       }
+       
+?>
+
+</body>
+</html>
+
index ce7b490b43cf8b3dfcc24796f978cd867327e0ef..883ddd0d923201f5a3ed492082877f4cd020c97e 100644 (file)
--- 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);
                }
        }
 
index f05fefcce90a8ba51b464eb67d24e156ab11b12a..f59f9ef3e56c04397c6a2d7de718df1d7305f353 100644 (file)
@@ -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);
                }
        }
 
index e7f1f4016e6f7f90cd5f5346295b76e4bdfdc99f..ce5d2535efec456ea34c49711870ab9d9be92bb7 100644 (file)
@@ -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);
                }
        }
 
index 9a1b8f43ddfd38480c9bbdd87ea0cf61a0ccf487..a6956dfa84b48eed63824335f2fc8f76fa2e4bfc 100644 (file)
@@ -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);
                }
        }
 
index affb09d0ef64f0b3cf6857471abc395a97a73d1c..07f423cbd492f3cba7cc28dd500ea526fa2fa2cb 100644 (file)
@@ -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);
                }
        }