# $Id$
+Version 0.9-beta3 ()
+------------------------------------------------------------------------
+ * Fix problem with b2evo importer when db was not in the same db
+ as serendipity. Thanks to Judebert from the forums! (garvinhicking)
+
Version 0.9-beta2 ()
------------------------------------------------------------------------
mysql_select_db($this->data['name']);
$return = &mysql_query($query, $db);
- print_r($return);
+ // print_r($return);
mysql_select_db($serendipity['dbName']);
return $return;
}
}
/* Categories */
- if (!$this->importCategories(null)) {
+ if (!$this->importCategories(null, 0, $b2db)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($b2db));
}
serendipity_rebuildCategoryTree();
return true;
}
- function importCategories($parentid = 0, $new_parentid = 0) {
+ function importCategories($parentid = 0, $new_parentid = 0, $b2db) {
if (is_null($parentid)) {
$where = 'WHERE ISNULL(cat_parent_ID)';
} else {
}
$res = $this->nativeQuery("SELECT * FROM evo_categories
- " . $where);
+ " . $where, $b2db);
if (!$res) {
echo mysql_error();
return false;
serendipity_db_insert('category', $this->strtrRecursive($cat));
$row['categoryid'] = serendipity_db_insert_id('category', 'categoryid');
$this->categories[] = $row;
- $this->importCategories($row['cat_ID'], $row['categoryid']);
+ $this->importCategories($row['cat_ID'], $row['categoryid'], $b2db);
}
return true;
}
/* Categories */
- if (!$this->importCategories(null)) {
+ if (!$this->importCategories(null, 0, $sunlogdb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($sunlogdb));
}
serendipity_rebuildCategoryTree();
return true;
}
- function importCategories($parentid = 0, $new_parentid = 0) {
+ function importCategories($parentid = 0, $new_parentid = 0, $sunlogdb) {
$where = "WHERE parent = '" . mysql_escape_string($parentid) . "'";
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}categories
- " . $where);
+ " . $where, $sunlogdb);
if (!$res) {
echo mysql_error();
return false;
serendipity_db_insert('category', $this->strtrRecursive($cat));
$row['categoryid'] = serendipity_db_insert_id('category', 'categoryid');
$this->categories[] = $row;
- $this->importCategories($row['id'], $row['categoryid']);
+ $this->importCategories($row['id'], $row['categoryid'], $sunlogdb);
}
return true;
}
/* Categories */
- if (!$this->importCategories('root')) {
+ if (!$this->importCategories('root', 0, $txpdb)) {
return sprintf(COULDNT_SELECT_CATEGORY_INFO, mysql_error($txpdb));
}
serendipity_rebuildCategoryTree();
return true;
}
- function importCategories($parentname = 'root', $parentid = 0) {
+ function importCategories($parentname = 'root', $parentid = 0, $txpdb) {
$res = $this->nativeQuery("SELECT * FROM {$this->data['prefix']}txp_category
- WHERE parent = '" . mysql_escape_string($parentname) . "' AND type = 'article'");
+ WHERE parent = '" . mysql_escape_string($parentname) . "' AND type = 'article'", $txpdb);
if (!$res) {
echo mysql_error();
return false;
serendipity_db_insert('category', $this->strtrRecursive($cat));
$row['categoryid'] = serendipity_db_insert_id('category', 'categoryid');
$this->categories[] = $row;
- $this->importCategories($row['name'], $row['categoryid']);
+ $this->importCategories($row['name'], $row['categoryid'], $txpdb);
}
return true;