Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4354
Modified Files:
Tag: branch-smarty
serendipity_db_mysql.inc.php serendipity_functions.inc.php
Log Message:
Make WP importer work with MySQL, i18n stuff.
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.419.2.48
retrieving revision 1.419.2.49
diff -u -d -r1.419.2.48 -r1.419.2.49
--- serendipity_functions.inc.php 11 Oct 2004 22:32:47 -0000 1.419.2.48
+++ serendipity_functions.inc.php 12 Oct 2004 21:00:11 -0000 1.419.2.49
@@ -2367,22 +2367,22 @@
}
if ( !extension_loaded('mysql') ) {
- return 'You must have the MySQL extension in order to access the WordPress database.';
+ return MYSQL_REQUIRED;;
}
$wpdb = @mysql_connect($wp['host'], $wp['user'], $wp['pass']);
if ( !$wpdb ) {
- return 'Could not connect to MySQL database: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_CONNECT, mysql_error($wpdb));
}
if ( !@mysql_select_db($wp['name']) ) {
- return 'Could not select database: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_SELECT_DB, mysql_error($wpdb));
}
/* Users */
$res = @mysql_query("SELECT ID, user_login, user_pass, user_email, user_level FROM {$wp['prefix']}users;", $wpdb);
if ( !$res ) {
- return 'Could not select user information: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_COULDNT_SELECT_USER_INFO, mysql_error($wpdb));
}
for ( $x=0 ; $x<mysql_num_rows($res) ; $x++ ) {
@@ -2407,7 +2407,7 @@
/* Categories */
$res = @mysql_query("SELECT cat_ID, cat_name, category_description, category_parent FROM {$wp['prefix']}categories ORDER BY category_parent, cat_ID;", $wpdb);
if ( !$res ) {
- return 'Could not select category information: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($wpdb));
}
// Get all the info we need
@@ -2449,7 +2449,7 @@
/* Entries */
$res = @mysql_query("SELECT * FROM {$wp['prefix']}posts ORDER BY post_date;", $wpdb);
if ( !$res ) {
- return 'Could not select entry information: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
}
for ( $x=0 ; $x<mysql_num_rows($res) ; $x++ ) {
@@ -2476,7 +2476,7 @@
/* Entry/category */
$res = @mysql_query("SELECT * FROM {$wp['prefix']}post2cat;", $wpdb);
if ( !$res ) {
- return 'Could not select entry/category information: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_SELECT_ENTRY_INFO, mysql_error($wpdb));
}
while ( $a = mysql_fetch_assoc($res) ) {
@@ -2498,7 +2498,7 @@
/* Comments */
$res = @mysql_query("SELECT * FROM {$wp['prefix']}comments;", $wpdb);
if ( !$res ) {
- return 'Could not select comment information: ' . mysql_error($wpdb);
+ return sprintf(COULDNT_SELECT_COMMENT_INFO, mysql_error($wpdb));
}
while ( $a = mysql_fetch_assoc($res) ) {
Index: serendipity_db_mysql.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_db_mysql.inc.php,v
retrieving revision 1.22.2.2
retrieving revision 1.22.2.3
diff -u -d -r1.22.2.2 -r1.22.2.3
--- serendipity_db_mysql.inc.php 22 Sep 2004 10:58:56 -0000 1.22.2.2
+++ serendipity_db_mysql.inc.php 12 Oct 2004 21:00:11 -0000 1.22.2.3
@@ -17,14 +17,14 @@
// highlight_string(var_export($sql, 1));
- $c = mysql_query($sql);
- if (mysql_error() != '') {
- return '<pre>' . $sql . '</pre> / ' . mysql_error();
+ $c = mysql_query($sql, $serendipity['dbConn']);
+ if (mysql_error($serendipity['dbConn']) != '') {
+ return '<pre>' . $sql . '</pre> / ' . mysql_error($serendipity['dbConn']);
}
if (!$c) {
if (!$serendipity['production']) {
- print '<pre>' . $sql . '</pre> / ' . mysql_error();
+ print '<pre>' . $sql . '</pre> / ' . mysql_error($serendipity['dbConn']);
if (function_exists('debug_backtrace') && $reportErr == true) {
highlight_string(var_export(debug_backtrace(), 1));
}
@@ -67,11 +67,15 @@
}
function serendipity_db_insert_id() {
- return mysql_insert_id();
+ global $serendipity;
+
+ return mysql_insert_id($serendipity['dbConn']);
}
function serendipity_db_affected_rows() {
- return mysql_affected_rows();
+ global $serendipity;
+
+ return mysql_affected_rows($serendipity['dbConn']);
}
function serendipity_db_escape_string($string) {
|