2 error_reporting(E_ERROR | E_WARNING | E_PARSE
);
4 require_once "../sessions.php";
6 require_once "../sanity_check.php";
7 require_once "../functions.php";
8 require_once "../config.php";
9 require_once "../db.php";
11 $link = db_connect(DB_HOST
, DB_USER
, DB_PASS
, DB_NAME
);
13 init_connection($link);
15 login_sequence($link);
17 $owner_uid = $_SESSION["uid"];
19 if (!SINGLE_USER_MODE
&& $_SESSION["access_level"] < 10) {
20 $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script.");
21 render_login_form($link);
30 <title
>MySQL Charset Converter
</title
>
31 <meta http
-equiv
="Content-Type" content
="text/html; charset=utf-8">
32 <link rel
="stylesheet" type
="text/css" href
="utility.css">
33 <script type
="text/javascript" src
="localized_js.php"></script
>
38 <script type
='text/javascript'>
39 function confirmOP() {
40 return confirm(__("Update the database?"));
44 <div
class="floatingLogo"><img src
="images/ttrss_logo.png"></div
>
46 <h1
><?php
echo __("MySQL Charset Updater") ?
></h1
>
52 if (DB_TYPE
!= "mysql") {
53 print_warning(__("This script is for Tiny Tiny RSS installations with MySQL backend only."));
55 print "<form method=\"GET\" action=\"logout.php\">
56 <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">
61 print_warning(__("Please backup your database before proceeding."));
63 print "<p>" . __("This script will convert your Tiny Tiny RSS database to UTF-8.
64 Depending on current database charset you may experience data corruption (lost accent characters, etc.).
65 After update, you'll have to set <b>MYSQL_CHARSET</b> option in config.php to 'utf8'.") . "</p>";
67 print "<form method='POST'>
68 <input type='hidden' name='op' value='do'>
69 <input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'>
72 } else if ($op == "do") {
74 print "<p>".__("Converting database...")."</p>";
76 db_query($link, "BEGIN");
77 db_query($link, "SET FOREIGN_KEY_CHECKS=0");
79 $result = db_query($link, "SHOW TABLES LIKE 'ttrss%'");
81 while ($line = db_fetch_assoc($result)) {
82 $vals = array_values($line);
85 $query = "ALTER TABLE $table CONVERT TO
86 CHARACTER SET 'utf8'";
88 print "<p class='query'>$query</p>";
90 db_query($link, $query);
93 db_query($link, "SET FOREIGN_KEY_CHECKS=1");
94 db_query($link, "COMMIT");
96 print "<form method=\"GET\" action=\"logout.php\">
97 <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\">