svalavuo 4 дней назад
Родитель
Сommit
59fc5c6438
1 измененных файлов с 10 добавлено и 4 удалено
  1. 10 4
      includes/wordpress_import.php

+ 10 - 4
includes/wordpress_import.php

@@ -425,6 +425,8 @@ class WordPressImport {
             
             
             $comments = $stmt->fetchAll();
             $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
             // Build a map of WordPress post IDs to publication IDs using wp_post_id field
             $postIds = array_unique(array_column($comments, 'comment_post_ID'));
             $postIds = array_unique(array_column($comments, 'comment_post_ID'));
             $publicationMap = [];
             $publicationMap = [];
@@ -440,10 +442,14 @@ class WordPressImport {
                     // Map WordPress post ID to publication ID
                     // Map WordPress post ID to publication ID
                     $publicationMap[$pub['wp_post_id']] = $pub['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 {
                 try {
+                    $this->log("Processing comment {$index}: '{$wpComment['comment_content']}' (Post ID: {$wpComment['comment_post_ID']})");
+                    
                     // Find corresponding publication using wp_post_id mapping
                     // Find corresponding publication using wp_post_id mapping
                     $publicationId = null;
                     $publicationId = null;
                     $wpPostId = $wpComment['comment_post_ID'];
                     $wpPostId = $wpComment['comment_post_ID'];
@@ -488,11 +494,11 @@ class WordPressImport {
                     );
                     );
                     
                     
                     $imported++;
                     $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) {
                 } 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');
                 }
                 }
             }
             }