Beiträge: 674
Themen: 82
Registriert seit: 06.03.2006
MyBB-Version: 1.4.10
14.02.2007, 17:33
(Dieser Beitrag wurde zuletzt bearbeitet: 14.02.2007, 20:28 von Susanne.)
Nach dem Klick auf "Konvertierung starten" kam bei mir diese Fehlermeldung.
Zitat:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-kochfeuer1 LIKE '_mybb_%'' at line 1
VG,
Susanne
Beiträge: 1.204
Themen: 17
Registriert seit: 07.08.2005
MyBB-Version: 1.4
Ich kenn die Datei nicht aber dieses kochfeuer1 soll kochfeuer' heißen denke ich
Sprich, das Wort muss in ' '
Beiträge: 674
Themen: 82
Registriert seit: 06.03.2006
MyBB-Version: 1.4.10
14.02.2007, 17:40
(Dieser Beitrag wurde zuletzt bearbeitet: 14.02.2007, 17:41 von Susanne.)
Nein, das kann es nicht sein.  Es ist ja keine Datei. Und die Fehlermeldung kommt nach dem Klick auf "Konvertierung starten", das hatte ich falsch ausgedrückt, aber gerade oben im Post verbessert.
VG,
Susanne
Beiträge: 1.204
Themen: 17
Registriert seit: 07.08.2005
MyBB-Version: 1.4
convert-encoding.php nennst du keine Datei? okok...hmm...
Wie gesagt, der Fehler liegt in der Convert Encoding datei ^^
Beiträge: 674
Themen: 82
Registriert seit: 06.03.2006
MyBB-Version: 1.4.10
14.02.2007, 18:00
(Dieser Beitrag wurde zuletzt bearbeitet: 14.02.2007, 18:08 von Susanne.)
 Okay, alles klar, ich weiß jetzt was du meintest.  Mir raucht der Kopf.
Der Inhalt dieser Datei sieht so aus:
PHP-Code: <?php
// +----------------------------------------------------------------------+
// | Convert wordpress content encoding |
// +----------------------------------------------------------------------+
// | Copyright (C) 2005 Markus Tacker <[email protected]> |
// +----------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the |
// | Free Software Foundation, Inc. |
// | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Modified by MyBBoard.de to convert the database of a MyBB |
// +----------------------------------------------------------------------+
/*
* Converts MyBB encodings
*
* IMPORTANT!
* Remember to dumpy your database first
*
* mysqldump --opt DB_NAME
*
* Or use phpMyAdmin:
* http://www.zerokspot.com/docs/howto.phpmyadmin.backup_and_restore/
* http://www.phpmyadmin.net/documentation/#faq6_3
*
* Do NOT run this script more then once
*
* Place this script inside the board's root folder and
* access it via the browser, e.g. http://yoursite.com/pathtoforum/convert-encoding.php
*
* Remember to remove it afterwards.
*/
if(!isset($_POST['submit'])) {
echo '<pre>';
echo "<strong>Konvertierung des Datenbankencodings für MyBB</strong>\n";
echo "----------------------------------------------------------------\n";
if(ini_get('safe_mode')) {
echo "<span style=\"color: #ff0000;\">WARNUNG: Der safe_mode ist in der PHP-Konfiguration Ihres Ser-\nvers aktiviert. Dadurch kann es passieren, dass das Skript bei\nder Konvertierung großer Datenbanken beendet wird. Sollten Sie\ndie Möglichkeit haben, deaktivieren Sie den safe_mode.</span>\n";
}
echo "Dieses Skript konvertiert das Encoding der Datenbank des Forums\nzu Unicode (UTF-8).\n";
echo "<span style=\"color: #ff0000;\">Sichern Sie Ihre Datenbank <strong>BEVOR</strong> Sie fortfahren! Sollte es Pro-\nbleme geben, können Sie diese wiederherstellen.\nFühren Sie dieses Skript nur einmal aus!</span>\n";
echo "Bitte beachten Sie, dass Sie nach der Konvertierung auch ein für\nUTF-8 geeignetes Sprachpaket verwenden.\n";
echo '</pre>';
echo '<form method="post" action="convert-encoding.php">';
echo "<input type=\"submit\" name=\"submit\" value=\"Konvertierung starten\" />";
echo '</form>';
} else {
// You have to remove the line below to make this script work
// By removing the line you accept the license agreement stated above
//die('Please follow the instructions in ' . $_SERVER['PHP_SELF']);
error_reporting(E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
@set_time_limit(0);
require_once "./inc/config.php";
// Relevant tables
$rel_tables = array(
$config['table_prefix']."adminlog",
$config['table_prefix']."adminoptions",
$config['table_prefix']."adminsessions",
$config['table_prefix']."announcements",
$config['table_prefix']."attachments",
$config['table_prefix']."attachtypes",
$config['table_prefix']."awaitingactivation",
$config['table_prefix']."badwords",
$config['table_prefix']."banned",
$config['table_prefix']."captcha",
$config['table_prefix']."events",
$config['table_prefix']."favorites",
$config['table_prefix']."forumpermissions",
$config['table_prefix']."forums",
$config['table_prefix']."forumsubscriptions",
$config['table_prefix']."groupleaders",
$config['table_prefix']."helpdocs",
$config['table_prefix']."helpsections",
$config['table_prefix']."icons",
$config['table_prefix']."joinrequests",
$config['table_prefix']."mailqueue",
$config['table_prefix']."moderatorlog",
$config['table_prefix']."moderators",
$config['table_prefix']."modtools",
$config['table_prefix']."mycode",
$config['table_prefix']."polls",
$config['table_prefix']."pollvotes",
$config['table_prefix']."posts",
$config['table_prefix']."privatemessages",
$config['table_prefix']."profilefields",
$config['table_prefix']."reportedposts",
$config['table_prefix']."reputation",
$config['table_prefix']."searchlog",
$config['table_prefix']."sessions",
$config['table_prefix']."settinggroups",
$config['table_prefix']."settings",
$config['table_prefix']."smilies",
$config['table_prefix']."templategroups",
$config['table_prefix']."templates",
$config['table_prefix']."themes",
$config['table_prefix']."threadratings",
$config['table_prefix']."threads",
$config['table_prefix']."threadsread",
$config['table_prefix']."upgrade_data",
$config['table_prefix']."userfields",
$config['table_prefix']."usergroups",
$config['table_prefix']."users",
$config['table_prefix']."usertitles"
);
/**
* @var string Target encoding
*/
$new_encoding = 'UTF-8';
/**
* @var string New collation for the table
*/
$new_mysql_collation = 'utf8_general_ci';
/**
* @var string New character set for the table
*/
$new_mysql_encoding = 'utf8';
/**
* You would set this switch to true if you have used this script before
* and Your titles contain invalid non-ascii charactes like "für"
* Your database entries are utf-8 encoded and need to be decoded, not converted.
*
* @var bool UTF-8 decode your content instead
*/
$decode = false;
// Connect to Database
mysql_connect($config['hostname'], $config['username'], $config['password']);
mysql_select_db($config['database']);
$result = mysql_query("SHOW TABLES FROM ".$config['database']." LIKE '".$config['table_prefix']."%'") or die(mysql_error());
echo '<pre>';
echo "<strong>Konvertierung des Datenbankencodings für MyBB</strong>\n";
echo "---------------------------------------------------------------\n";
echo 'Modus: <strong>' . (($decode) ? 'Dekodierung' : 'Konvertierung') . "</strong>\n";
echo 'Neues Encoding: <strong>' . $new_encoding . "</strong>\n";
echo 'Neues Encoding für MySQL: <strong>' . $new_mysql_encoding . "</strong>\n";
echo 'Neue Collation für MySQL: <strong>' . $new_mysql_collation . "</strong>\n";
while ($row = mysql_fetch_row($result)) {
// Convert the tables encoding
$sql = 'ALTER TABLE ' . ek($row[0]) . ' DEFAULT CHARACTER SET ' . $new_mysql_encoding . ' COLLATE ' . $new_mysql_collation;
mysql_query($sql);
// Convert the fields
$sql = 'SHOW CREATE TABLE ' . ek($row[0]);
$result2 = mysql_query($sql);
$table_sql = mysql_fetch_assoc($result2);
foreach (explode("\n", $table_sql['Create Table']) as $line) {
$line = trim($line);
if (!preg_match('/ character set ([^ ]+)/', $line, $match_cs)) continue;
preg_match('/^`[^`]+`/', $line, $match_field);
$sql = 'ALTER TABLE ' . ek($row[0])
. ' CHANGE ' . $match_field[0] . ' '
. str_replace($match_cs[0], ' character set ' . $new_mysql_encoding . ' COLLATE ' . $new_mysql_collation, substr($line, 0, -1));
mysql_query($sql);
}
// Convert its data
$result_data = mysql_query('SELECT * FROM ' . $row[0]);
echo $row[0] . ' ';
while ($data = mysql_fetch_assoc($result_data)) {
if(in_array($row[0], $rel_tables)) {
$sql = 'UPDATE ' . $row[0];
// Build set
$set = array();
foreach ($data as $key => $val) {
if ($decode) {
$set[] = ek($key) . '=' . ev(utf8_decode($data[$key]));
} else {
$set[] = ek($key) . '=' . ev(mb_convert_encoding($data[$key], $new_encoding, "ISO-8859-1"));
}
}
$sql .= ' SET ' . join(', ', $set);
// Build where
$where = array();
foreach ($data as $key => $val) {
if (!preg_match('/[0-9]+/', $val)) continue; // Use only numbers in where
$where[] = ek($key) . '=' . ev($data[$key]);
}
$sql .= ' WHERE ' . join(' AND ', $where);
$query_result = mysql_query($sql);
if (!$query_result) {
die('Invalid query: ' . mysql_error());
}
echo '.';
flush();
}
}
echo "\n";
}
echo '<span style="color: #009900;">Alle Schritte durchgeführt.</span>'."\n";
echo '<span style="color: #ff0000;">Bitte löschen Sie dieses Skript vom Server!</span>' . "\n";
echo '</pre>';
// Disconnect
mysql_close();
}
function ek($string) {
global $DBC;
return "`" . mysql_real_escape_string($string) . "`";
}
function ev($string) {
global $DBC;
return "'" . mysql_real_escape_string($string) . "'";
}
?>
VG,
Susanne
Beiträge: 674
Themen: 82
Registriert seit: 06.03.2006
MyBB-Version: 1.4.10
Kann es sein, dass diese Fehlermeldung kommt, weil es bei mir nicht mybb_ in der Datenbank heißt?
VG,
Susanne
Beiträge: 18.383
Themen: 257
Registriert seit: 09.02.2005
Kannst du mir bitte den gesamten Inhalt der Datei inc/config.php per PN schicken? Das Passwort kannst du rauslöschen.
Gruß,
Michael
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Beiträge: 18.383
Themen: 257
Registriert seit: 09.02.2005
Info: Der Fehler wurde gefunden und im Download korrigiert.
Gruß,
Michael
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
Beiträge: 1.204
Themen: 17
Registriert seit: 07.08.2005
MyBB-Version: 1.4
Nur so zur wissensgier: War mein Fehler richtig den ich gefunden habe,
oder anders gefragt: wo war der fehler ^^
Beiträge: 18.383
Themen: 257
Registriert seit: 09.02.2005
Es war ein Anführungszeichenproblem, wobei ich immer noch nicht genau weiß warum. Komischwerweise hat das Skript ja vorher auch schon funktioniert.
Gruß,
Michael
Support erfolgt NUR im Forum!
Bitte gelöste Themen als "erledigt" markieren.
Beiträge mit mangelhafter Rechtschreibung/Grammatik werden kommentarlos gelöscht.
|