| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- // Debug script to test main wordpress_import.php hanging issue
- error_reporting(E_ALL);
- ini_set('display_errors', 1);
- ini_set('max_execution_time', 30);
- ini_set('memory_limit', '256M');
- echo "<h1>Debug Main WordPress Import</h1>";
- // Test 1: Basic PHP and includes
- echo "<p>Step 1: Testing includes...</p>";
- try {
- require_once '../includes/config.php';
- echo "<p>✓ Config included</p>";
- } catch (Exception $e) {
- echo "<p>✗ Config error: " . $e->getMessage() . "</p>";
- exit;
- }
- try {
- require_once '../includes/database.php';
- echo "<p>✓ Database included</p>";
- } catch (Exception $e) {
- echo "<p>✗ Database error: " . $e->getMessage() . "</p>";
- exit;
- }
- try {
- require_once '../includes/auth.php';
- echo "<p>✓ Auth included</p>";
- } catch (Exception $e) {
- echo "<p>✗ Auth error: " . $e->getMessage() . "</p>";
- exit;
- }
- try {
- require_once '../includes/translation.php';
- echo "<p>✓ Translation included</p>";
- } catch (Exception $e) {
- echo "<p>✗ Translation error: " . $e->getMessage() . "</p>";
- exit;
- }
- try {
- require_once '../includes/wordpress_import.php';
- echo "<p>✓ WordPressImport included</p>";
- } catch (Exception $e) {
- echo "<p>✗ WordPressImport error: " . $e->getMessage() . "</p>";
- exit;
- }
- // Test 2: Auth system
- echo "<p>Step 2: Testing auth system...</p>";
- try {
- $auth = new Auth();
- echo "<p>✓ Auth instance created</p>";
-
- if ($auth->isLoggedIn()) {
- echo "<p>✓ User is logged in</p>";
- $user = $auth->getUser();
- echo "<p>User: " . htmlspecialchars($user['username']) . " (Role: " . $user['role'] . ")</p>";
- } else {
- echo "<p>⚠ User not logged in</p>";
- }
- } catch (Exception $e) {
- echo "<p>✗ Auth error: " . $e->getMessage() . "</p>";
- exit;
- }
- // Test 3: Database connection
- echo "<p>Step 3: Testing database connection...</p>";
- try {
- $db = Database::getInstance();
- echo "<p>✓ Database instance created</p>";
-
- $result = $db->query("SELECT 1 as test");
- echo "<p>✓ Database query successful</p>";
- } catch (Exception $e) {
- echo "<p>✗ Database error: " . $e->getMessage() . "</p>";
- exit;
- }
- // Test 4: WordPressImport creation (same as main interface)
- echo "<p>Step 4: Testing WordPressImport creation...</p>";
- try {
- $wpConfig = [
- 'host' => '10.15.10.8',
- 'database' => 'valtsu_valtsu',
- 'username' => 'root',
- 'password' => 'jotainaivanmuuta'
- ];
-
- echo "<p>About to create WordPressImport...</p>";
- $importer = new WordPressImport($wpConfig);
- echo "<p>✓ WordPressImport created successfully</p>";
-
- } catch (Exception $e) {
- echo "<p>✗ WordPressImport creation error: " . $e->getMessage() . "</p>";
- echo "<p>File: " . $e->getFile() . "</p>";
- echo "<p>Line: " . $e->getLine() . "</p>";
- exit;
- }
- // Test 5: Test connection (same as main interface)
- echo "<p>Step 5: Testing WordPress connection...</p>";
- try {
- echo "<p>About to test connection...</p>";
- $connectionTest = $importer->testConnection();
- echo "<p>✓ Connection test completed</p>";
- echo "<pre>" . print_r($connectionTest, true) . "</pre>";
-
- } catch (Exception $e) {
- echo "<p>✗ Connection test error: " . $e->getMessage() . "</p>";
- echo "<p>File: " . $e->getFile() . "</p>";
- echo "<p>Line: " . $e->getLine() . "</p>";
- exit;
- }
- echo "<h2>All tests completed successfully!</h2>";
- ?>
|