mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
64 lines
2.1 KiB
PHP
64 lines
2.1 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
try {
|
|
echo "=== Sync Existing Performers with Stash ===\n";
|
|
|
|
$config = require __DIR__ . '/config/database.php';
|
|
\App\Database\Database::setConfig($config);
|
|
$pdo = \App\Database\Database::getInstance();
|
|
|
|
// Get Stash configuration from database
|
|
$stmt = $pdo->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);
|
|
}
|