prepare('SELECT * FROM sources WHERE name = ?'); $stmt->execute(['stash']); $stashSource = $stmt->fetch(\PDO::FETCH_ASSOC); if (!$stashSource) { echo "ERROR: Stash source not configured in database\n"; exit(1); } echo "Found Stash configuration: {$stashSource['display_name']}\n"; // Create Stash sync service $stashSyncService = new \App\Services\StashSyncService($pdo, $stashSource); // Run the existing performers sync echo "Starting sync of existing performers...\n"; $results = $stashSyncService->syncExistingPerformers(); echo "\n=== Sync Results ===\n"; echo "Processed: {$results['processed']} performers\n"; echo "Updated: {$results['updated']} performers\n"; echo "Skipped: {$results['skipped']} performers\n"; echo "Not found in Stash: " . count($results['not_found_in_stash']) . " performers\n"; echo "Errors: " . count($results['errors']) . " performers\n"; if (!empty($results['not_found_in_stash'])) { echo "\n=== Actors Not Found in Stash ===\n"; echo "These actors exist in your local database but were not found in Stash.\n"; echo "You can create them in Stash for future syncs.\n\n"; foreach ($results['not_found_in_stash'] as $missingActor) { echo "- {$missingActor['name']} (ID: {$missingActor['id']})\n"; } echo "\nA detailed report has been saved to storage/logs/\n"; } if (!empty($results['errors'])) { echo "\n=== Errors ===\n"; foreach ($results['errors'] as $error) { echo "- {$error}\n"; } } echo "\nSync completed successfully!\n"; } catch (Exception $e) { echo "ERROR: " . $e->getMessage() . "\n"; echo "Stack trace:\n" . $e->getTraceAsString() . "\n"; exit(1); }