|
|
@@ -1,17 +1,15 @@
|
|
|
<?php
|
|
|
-// Start session for language preference
|
|
|
-if (session_status() === PHP_SESSION_NONE) {
|
|
|
- session_start();
|
|
|
-}
|
|
|
+// Simple WordPress import interface without complex session handling
|
|
|
+error_reporting(E_ALL);
|
|
|
+ini_set('display_errors', 0);
|
|
|
+ini_set('max_execution_time', 120);
|
|
|
+ini_set('memory_limit', '512M');
|
|
|
|
|
|
require_once '../includes/config.php';
|
|
|
require_once '../includes/database.php';
|
|
|
require_once '../includes/auth.php';
|
|
|
-require_once '../includes/wordpress_import.php';
|
|
|
require_once '../includes/translation.php';
|
|
|
|
|
|
-// Translation system is auto-initialized when translation.php is included
|
|
|
-
|
|
|
$auth = new Auth();
|
|
|
$auth->requireAuth();
|
|
|
|
|
|
@@ -20,12 +18,9 @@ $message = '';
|
|
|
$importResults = null;
|
|
|
$connectionTest = null;
|
|
|
|
|
|
-// Handle form submission
|
|
|
+// Handle form submission with simplified processing
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
try {
|
|
|
- // Debug: Log form submission
|
|
|
- error_log('WordPress import form submitted');
|
|
|
-
|
|
|
// Get WordPress database configuration
|
|
|
$wpConfig = [
|
|
|
'host' => trim($_POST['wp_host'] ?? ''),
|
|
|
@@ -34,38 +29,18 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
'password' => $_POST['wp_password'] ?? ''
|
|
|
];
|
|
|
|
|
|
- // Debug: Log config (without password)
|
|
|
- error_log('WP Config: ' . print_r([
|
|
|
- 'host' => $wpConfig['host'],
|
|
|
- 'database' => $wpConfig['database'],
|
|
|
- 'username' => $wpConfig['username'],
|
|
|
- 'password' => !empty($wpConfig['password']) ? '[SET]' : '[EMPTY]'
|
|
|
- ], true));
|
|
|
-
|
|
|
// Validate required fields
|
|
|
if (empty($wpConfig['host']) || empty($wpConfig['database']) || empty($wpConfig['username'])) {
|
|
|
throw new Exception(t('wordpress_import_config_required'));
|
|
|
}
|
|
|
|
|
|
- // Debug: About to create importer
|
|
|
- error_log('About to create WordPressImport instance');
|
|
|
-
|
|
|
// Create import instance
|
|
|
$importer = new WordPressImport($wpConfig);
|
|
|
|
|
|
- // Debug: Importer created successfully
|
|
|
- error_log('WordPressImport instance created successfully');
|
|
|
-
|
|
|
if (isset($_POST['test_connection'])) {
|
|
|
- // Debug: Testing connection
|
|
|
- error_log('About to test WordPress connection');
|
|
|
-
|
|
|
// Test connection only
|
|
|
$connectionTest = $importer->testConnection();
|
|
|
|
|
|
- // Debug: Connection test result
|
|
|
- error_log('Connection test result: ' . print_r($connectionTest, true));
|
|
|
-
|
|
|
if ($connectionTest['success']) {
|
|
|
$message = t('wordpress_connection_success') . ': ' .
|
|
|
t('posts') . ': ' . $connectionTest['stats']['posts'] . ', ' .
|
|
|
@@ -76,9 +51,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
throw new Exception($connectionTest['error']);
|
|
|
}
|
|
|
} elseif (isset($_POST['start_import'])) {
|
|
|
- // Debug: Starting import
|
|
|
- error_log('About to start WordPress import');
|
|
|
-
|
|
|
// Start import
|
|
|
$importOptions = [
|
|
|
'import_categories' => isset($_POST['import_categories']),
|
|
|
@@ -87,21 +59,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
|
'import_comments' => isset($_POST['import_comments'])
|
|
|
];
|
|
|
|
|
|
- error_log('Import options: ' . print_r($importOptions, true));
|
|
|
-
|
|
|
- // Debug: About to call importAll
|
|
|
- error_log('About to call importer->importAll()');
|
|
|
-
|
|
|
$importResults = $importer->importAll($importOptions);
|
|
|
|
|
|
- // Debug: Import completed
|
|
|
- error_log('importAll() completed');
|
|
|
-
|
|
|
if ($importResults['success']) {
|
|
|
$message = t('wordpress_import_success');
|
|
|
- error_log('Import successful: ' . print_r($importResults['results'], true));
|
|
|
} else {
|
|
|
- error_log('Import failed: ' . $importResults['error']);
|
|
|
throw new Exception($importResults['error']);
|
|
|
}
|
|
|
}
|