|
|
@@ -425,6 +425,8 @@ class WordPressImport {
|
|
|
|
|
|
$comments = $stmt->fetchAll();
|
|
|
|
|
|
+ $this->log("Found " . count($comments) . " WordPress comments to import");
|
|
|
+
|
|
|
// Build a map of WordPress post IDs to publication IDs using wp_post_id field
|
|
|
$postIds = array_unique(array_column($comments, 'comment_post_ID'));
|
|
|
$publicationMap = [];
|
|
|
@@ -440,10 +442,14 @@ class WordPressImport {
|
|
|
// Map WordPress post ID to publication ID
|
|
|
$publicationMap[$pub['wp_post_id']] = $pub['id'];
|
|
|
}
|
|
|
+
|
|
|
+ $this->log("Found " . count($publicationMap) . " publication mappings for comments");
|
|
|
}
|
|
|
|
|
|
- foreach ($comments as $wpComment) {
|
|
|
+ foreach ($comments as $index => $wpComment) {
|
|
|
try {
|
|
|
+ $this->log("Processing comment {$index}: '{$wpComment['comment_content']}' (Post ID: {$wpComment['comment_post_ID']})");
|
|
|
+
|
|
|
// Find corresponding publication using wp_post_id mapping
|
|
|
$publicationId = null;
|
|
|
$wpPostId = $wpComment['comment_post_ID'];
|
|
|
@@ -488,11 +494,11 @@ class WordPressImport {
|
|
|
);
|
|
|
|
|
|
$imported++;
|
|
|
- $this->log("Imported comment for post ID {$wpComment['comment_post_ID']}");
|
|
|
+ $this->log("Successfully imported comment: '{$wpComment['comment_content']}' (ID: {$wpComment['comment_ID']})");
|
|
|
|
|
|
} catch (Exception $e) {
|
|
|
- $this->errors[] = "Error importing comment: " . $e->getMessage();
|
|
|
- $this->log("Error importing comment: " . $e->getMessage(), 'error');
|
|
|
+ $skipped++;
|
|
|
+ $this->log("Skipped comment '{$wpComment['comment_content']}' (ID: {$wpComment['comment_ID']}): " . $e->getMessage(), 'error');
|
|
|
}
|
|
|
}
|
|
|
|