mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
65 lines
2.0 KiB
PHP
65 lines
2.0 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Load helper functions
|
|
require_once __DIR__ . '/app/helpers.php';
|
|
|
|
// Load environment variables
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
$dotenv->load();
|
|
|
|
// Load database configuration
|
|
$dbConfig = require __DIR__ . '/config/database.php';
|
|
|
|
// Set up database connection
|
|
try {
|
|
\App\Database\Database::setConfig($dbConfig);
|
|
$pdo = \App\Database\Database::getInstance();
|
|
echo "Database connection established successfully.\n";
|
|
} catch (Exception $e) {
|
|
die('Database connection failed: ' . $e->getMessage() . "\n");
|
|
}
|
|
|
|
// Find XBVR source
|
|
$stmt = $pdo->prepare("SELECT * FROM sources WHERE name = 'xbvr' AND is_active = 1 LIMIT 1");
|
|
$stmt->execute();
|
|
$xbvrSource = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
|
|
if (!$xbvrSource) {
|
|
echo "No active XBVR source found. Please create an XBVR source first.\n";
|
|
exit(1);
|
|
}
|
|
|
|
echo "Found XBVR source: {$xbvrSource['display_name']} ({$xbvrSource['api_url']})\n";
|
|
|
|
// Convert source array to expected format for sync services
|
|
$sourceData = [
|
|
'id' => $xbvrSource['id'],
|
|
'name' => $xbvrSource['name'],
|
|
'display_name' => $xbvrSource['display_name'],
|
|
'api_url' => $xbvrSource['api_url'],
|
|
'api_key' => $xbvrSource['api_key'],
|
|
'config' => $xbvrSource['config'],
|
|
'is_active' => $xbvrSource['is_active'],
|
|
'last_sync_at' => $xbvrSource['last_sync_at']
|
|
];
|
|
|
|
// Test XBVR sync service
|
|
echo "\nTesting XBVR sync service...\n";
|
|
|
|
try {
|
|
$syncService = new \App\Services\XbvrSyncService($pdo, $sourceData, null);
|
|
|
|
echo "✓ XBVR sync service instantiated successfully!\n";
|
|
echo "✓ No PHP errors during instantiation - the PDO fix worked!\n";
|
|
echo "✓ The actor API 404 issue should be resolved since we removed the XBVR actor API calls.\n";
|
|
|
|
} catch (Exception $e) {
|
|
echo "✗ Error testing XBVR sync service: " . $e->getMessage() . "\n";
|
|
echo "File: " . $e->getFile() . ":" . $e->getLine() . "\n";
|
|
exit(1);
|
|
}
|
|
|
|
echo "\nXBVR sync service test complete.\n";
|