ソースを参照

FIx to wordpress_import

svalavuo 4 日 前
コミット
9cbeab8903
1 ファイル変更8 行追加11 行削除
  1. 8 11
      includes/wordpress_import.php

+ 8 - 11
includes/wordpress_import.php

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