mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
- Deleted test scripts: test_jellyfin_execution.php, test_stash.php, test_xbvr.php, test_xbvr_sync.php, vite.config.js - Added DashboardController for fetching dashboard statistics and recent activity - Added GameController for managing games, including fetching all games, game details, and games by category - Introduced various check scripts to validate database structures and data integrity for adult videos, games, gender data, posters, and TV show actors
81 lines
2.4 KiB
PHP
81 lines
2.4 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
// Load environment variables
|
|
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
|
$dotenv->load();
|
|
|
|
// Load database configuration
|
|
$dbConfig = require __DIR__ . '/config/database.php';
|
|
\App\Database\Database::setConfig($dbConfig);
|
|
|
|
// Initialize database
|
|
try {
|
|
$pdo = \App\Database\Database::getInstance();
|
|
echo "✅ Database connection successful\n";
|
|
} catch (Exception $e) {
|
|
die('❌ Database connection failed: ' . $e->getMessage());
|
|
}
|
|
|
|
// Check gender data in actors table
|
|
try {
|
|
echo "\n🔍 Checking Gender Data:\n";
|
|
|
|
// Check if metadata column exists and has gender data
|
|
$stmt = $pdo->query("
|
|
SELECT name, metadata
|
|
FROM actors
|
|
WHERE metadata IS NOT NULL
|
|
AND metadata != ''
|
|
AND JSON_EXTRACT(metadata, '$.gender') IS NOT NULL
|
|
LIMIT 10
|
|
");
|
|
$actors = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
echo "Found " . count($actors) . " actors with gender metadata:\n";
|
|
|
|
foreach ($actors as $actor) {
|
|
$metadata = json_decode($actor['metadata'], true);
|
|
$gender = $metadata['gender'] ?? 'null';
|
|
echo " - {$actor['name']}: {$gender}\n";
|
|
}
|
|
|
|
// Count actors by gender
|
|
echo "\n📊 Gender Statistics:\n";
|
|
|
|
$genders = ['male', 'female', 'non-binary'];
|
|
foreach ($genders as $gender) {
|
|
$stmt = $pdo->prepare("
|
|
SELECT COUNT(*) as count
|
|
FROM actors
|
|
WHERE JSON_EXTRACT(metadata, '$.gender') = :gender
|
|
");
|
|
$stmt->execute(['gender' => $gender]);
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
echo " - " . ucfirst($gender) . ": " . $result['count'] . "\n";
|
|
}
|
|
|
|
// Check actors without gender
|
|
$stmt = $pdo->query("
|
|
SELECT COUNT(*) as count
|
|
FROM actors
|
|
WHERE metadata IS NULL
|
|
OR metadata = ''
|
|
OR JSON_EXTRACT(metadata, '$.gender') IS NULL
|
|
");
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
echo " - No gender data: " . $result['count'] . "\n";
|
|
|
|
// Total actors
|
|
$stmt = $pdo->query("SELECT COUNT(*) as count FROM actors");
|
|
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
echo " - Total actors: " . $result['count'] . "\n";
|
|
|
|
} catch (Exception $e) {
|
|
echo "❌ Error checking gender data: " . $e->getMessage() . "\n";
|
|
echo "Stack trace: " . $e->getTraceAsString() . "\n";
|
|
}
|
|
|
|
echo "\n✨ Check completed!\n";
|