|
|
@@ -145,6 +145,11 @@ class WordPressImport {
|
|
|
$imported = 0;
|
|
|
$skipped = 0;
|
|
|
|
|
|
+ // Connect to WordPress database if not already connected
|
|
|
+ if ($this->wpDb === null) {
|
|
|
+ $this->connectWordPress();
|
|
|
+ }
|
|
|
+
|
|
|
// Get WordPress categories
|
|
|
$stmt = $this->wpDb->query("
|
|
|
SELECT t.name, tt.description, tt.term_id
|
|
|
@@ -200,6 +205,11 @@ class WordPressImport {
|
|
|
$imported = 0;
|
|
|
$skipped = 0;
|
|
|
|
|
|
+ // Connect to WordPress database if not already connected
|
|
|
+ if ($this->wpDb === null) {
|
|
|
+ $this->connectWordPress();
|
|
|
+ }
|
|
|
+
|
|
|
// Get WordPress users
|
|
|
$stmt = $this->wpDb->query("
|
|
|
SELECT ID, user_login, user_email, user_nicename, user_registered, display_name
|
|
|
@@ -260,6 +270,11 @@ class WordPressImport {
|
|
|
$skipped = 0;
|
|
|
|
|
|
try {
|
|
|
+ // Connect to WordPress database if not already connected
|
|
|
+ if ($this->wpDb === null) {
|
|
|
+ $this->connectWordPress();
|
|
|
+ }
|
|
|
+
|
|
|
// Get WordPress posts with author info in one query
|
|
|
$stmt = $this->wpDb->query("
|
|
|
SELECT p.ID, p.post_title, p.post_content, p.post_excerpt, p.post_date,
|
|
|
@@ -359,6 +374,11 @@ class WordPressImport {
|
|
|
$skipped = 0;
|
|
|
|
|
|
try {
|
|
|
+ // Connect to WordPress database if not already connected
|
|
|
+ if ($this->wpDb === null) {
|
|
|
+ $this->connectWordPress();
|
|
|
+ }
|
|
|
+
|
|
|
// Get WordPress comments with post info in one query
|
|
|
$stmt = $this->wpDb->query("
|
|
|
SELECT c.comment_ID, c.comment_post_ID, c.comment_author, c.comment_author_email,
|