|
@@ -176,12 +176,9 @@ class WordPressImport {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Insert new category
|
|
// Insert new category
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"INSERT INTO categories (name, description, created_at) VALUES (?, ?, NOW())",
|
|
"INSERT INTO categories (name, description, created_at) VALUES (?, ?, NOW())",
|
|
|
- [
|
|
|
|
|
- $wpCategory['name'],
|
|
|
|
|
- $wpCategory['description'] ?? ''
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ [$wpCategory['name'], $wpCategory['description'] ?? '']
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
$imported++;
|
|
$imported++;
|
|
@@ -238,7 +235,7 @@ class WordPressImport {
|
|
|
$role = $this->getUserRole($wpUser['ID']);
|
|
$role = $this->getUserRole($wpUser['ID']);
|
|
|
|
|
|
|
|
// Insert new user
|
|
// Insert new user
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"INSERT INTO users (username, email, role, auth_type, created_at) VALUES (?, ?, ?, 'wordpress', ?)",
|
|
"INSERT INTO users (username, email, role, auth_type, created_at) VALUES (?, ?, ?, 'wordpress', ?)",
|
|
|
[
|
|
[
|
|
|
$wpUser['user_login'],
|
|
$wpUser['user_login'],
|
|
@@ -324,7 +321,7 @@ class WordPressImport {
|
|
|
$categories = $categoriesMap[$wpPost['ID']] ?? [];
|
|
$categories = $categoriesMap[$wpPost['ID']] ?? [];
|
|
|
|
|
|
|
|
// Insert post
|
|
// Insert post
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"INSERT INTO publications (title, slug, content, summary, author, status, created_at, updated_at, published_at)
|
|
"INSERT INTO publications (title, slug, content, summary, author, status, created_at, updated_at, published_at)
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)",
|
|
|
[
|
|
[
|
|
@@ -441,7 +438,7 @@ class WordPressImport {
|
|
|
$parentId = null;
|
|
$parentId = null;
|
|
|
|
|
|
|
|
// Insert comment
|
|
// Insert comment
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"INSERT INTO comments (publication_id, parent_id, name, email, content, status, created_at, admin_reply)
|
|
"INSERT INTO comments (publication_id, parent_id, name, email, content, status, created_at, admin_reply)
|
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, FALSE)",
|
|
VALUES (?, ?, ?, ?, ?, ?, ?, FALSE)",
|
|
|
[
|
|
[
|
|
@@ -455,10 +452,10 @@ class WordPressImport {
|
|
|
]
|
|
]
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- $commentId = $this->targetDb->lastInsertId();
|
|
|
|
|
|
|
+ $commentId = $this->targetDb->getConnection()->lastInsertId();
|
|
|
|
|
|
|
|
// Store WordPress comment ID for parent mapping
|
|
// Store WordPress comment ID for parent mapping
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"UPDATE comments SET wp_comment_id = ? WHERE id = ?",
|
|
"UPDATE comments SET wp_comment_id = ? WHERE id = ?",
|
|
|
[$wpComment['comment_ID'], $commentId]
|
|
[$wpComment['comment_ID'], $commentId]
|
|
|
);
|
|
);
|
|
@@ -537,7 +534,7 @@ class WordPressImport {
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
if ($category) {
|
|
if ($category) {
|
|
|
- $this->targetDb->execute(
|
|
|
|
|
|
|
+ $this->targetDb->query(
|
|
|
"INSERT IGNORE INTO publication_categories (publication_id, category_id) VALUES (?, ?)",
|
|
"INSERT IGNORE INTO publication_categories (publication_id, category_id) VALUES (?, ?)",
|
|
|
[$publicationId, $category['id']]
|
|
[$publicationId, $category['id']]
|
|
|
);
|
|
);
|