[geeklog-cvs] geeklog: Since BigDump has to skip the /*! lines, we need to tak...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Jan 12 04:22:42 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/1dbd8d39fbd2
changeset: 6671:1dbd8d39fbd2
user: Dirk Haun <dirk at haun-online.de>
date: Sat Jan 10 15:51:48 2009 +0100
description:
Since BigDump has to skip the /*! lines, we need to take care of utf8 ourselves
diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
public_html/admin/install/bigdump.php | 9 ++++++---
public_html/admin/install/migrate.php | 6 ++++++
diffs (64 lines):
diff -r ea5e93e5bb47 -r 1dbd8d39fbd2 public_html/admin/install/bigdump.php
--- a/public_html/admin/install/bigdump.php Sat Jan 10 10:29:04 2009 +0100
+++ b/public_html/admin/install/bigdump.php Sat Jan 10 15:51:48 2009 +0100
@@ -8,7 +8,7 @@
// | |
// | Staggered import for large MySQL Dumps |
// +---------------------------------------------------------------------------+
-// | Copyright (C) 2008 by the following authors: |
+// | Copyright (C) 2008-2009 by the following authors: |
// | |
// | Authors: Alexey Ozerov - alexey AT ozerov DOT de (BigDump author) |
// | Matt West - matt.danger.west AT gmail DOT com |
@@ -72,6 +72,9 @@
// Connection character set should be the same as the dump file character set (utf8, latin1, cp1251, koi8r etc.)
// See http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html for the full list
$db_connection_charset = '';
+if (isset($_REQUEST['db_connection_charset'])) {
+ $db_connection_charset = preg_replace('/[^a-z0-9\-_]/', '', $_REQUEST['db_connection_charset']);
+}
// *******************************************************************************************
// If not familiar with PHP please don't change anything below this line
@@ -369,9 +372,9 @@
// Go to the next step
echo '<script language="JavaScript" type="text/javascript">window.setTimeout(\'location.href="'
. $_SERVER['PHP_SELF'] . '?start=' . $linenumber . '&fn='
- . urlencode($curfilename) . '&foffset=' . $foffset . '&totalqueries=' . $totalqueries . '&language=' . $language . '&site_url=' . $site_url . '&site_admin_url=' . $site_admin_url . '";\',500+' . $delaypersession . ');</script>' . LB
+ . urlencode($curfilename) . '&foffset=' . $foffset . '&totalqueries=' . $totalqueries . '&db_connection_charset=' . $db_connection_charset . '&language=' . $language . '&site_url=' . $site_url . '&site_admin_url=' . $site_admin_url . '";\',500+' . $delaypersession . ');</script>' . LB
. '<noscript>' . LB
- . ' <p><a href="' . $_SERVER['PHP_SELF'] . '?start=' . $linenumber . '&fn=' . urlencode($curfilename) . '&foffset=' . $foffset . '&totalqueries=' . $totalqueries . '&site_url=' . $site_url . '&site_admin_url=' . $site_admin_url . '">Continue from the line ' . $linenumber . '</a></p>' . LB
+ . ' <p><a href="' . $_SERVER['PHP_SELF'] . '?start=' . $linenumber . '&fn=' . urlencode($curfilename) . '&foffset=' . $foffset . '&totalqueries=' . $totalqueries . '&db_connection_charset=' . $db_connection_charset . '&language=' . $language . '&site_url=' . $site_url . '&site_admin_url=' . $site_admin_url . '">Continue from the line ' . $linenumber . '</a></p>' . LB
. '</noscript>' . LB
. '<p><b><a href="' . $_SERVER['PHP_SELF'] . '">' . $LANG_BIGDUMP[26] . '</a></b> ' . $LANG_BIGDUMP[27] . ' <b>' . $LANG_BIGDUMP[28] . '</b></p>' . LB;
}
diff -r ea5e93e5bb47 -r 1dbd8d39fbd2 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Sat Jan 10 10:29:04 2009 +0100
+++ b/public_html/admin/install/migrate.php Sat Jan 10 15:51:48 2009 +0100
@@ -542,6 +542,7 @@
// Parse the .sql file to grab the table prefix
$has_config = false;
$num_create = 0;
+ $db_connection_charset = '';
$DB['table_prefix'] = '';
$sql_file = @fopen($backup_dir . $backup_file, 'r');
@@ -570,6 +571,10 @@
// assume there's no conf_values table in here
break;
}
+ } elseif (substr($line, 0, 3) == '/*!') {
+ if (strpos($line, 'SET NAMES utf8') !== false) {
+ $db_connection_charset = 'utf8';
+ }
}
}
}
@@ -589,6 +594,7 @@
// Send file to bigdump.php script to do the import.
header('Location: bigdump.php?start=1&foffset=0&totalqueries=0'
+ . '&db_connection_charset=' . $db_connection_charset
. '&language=' . $language
. '&fn=' . urlencode($backup_dir . $backup_file)
. '&site_url=' . urlencode($_REQUEST['site_url'])
More information about the geeklog-cvs
mailing list