mirror of
https://github.com/ceratic/MediaCollectorLibary.git
synced 2026-05-13 23:56:46 +02:00
first commit
This commit is contained in:
47
check_db.php
Normal file
47
check_db.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?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 current movie count
|
||||
try {
|
||||
$stmt = $pdo->query("SELECT COUNT(*) as count FROM movies");
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
echo "📊 Current movies in database: {$result['count']}\n";
|
||||
|
||||
// Check recent sync logs
|
||||
$stmt = $pdo->query("SELECT * FROM sync_logs ORDER BY created_at DESC LIMIT 5");
|
||||
$syncLogs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
if (empty($syncLogs)) {
|
||||
echo "📋 No sync logs found\n";
|
||||
} else {
|
||||
echo "📋 Recent sync logs:\n";
|
||||
foreach ($syncLogs as $log) {
|
||||
echo " - ID: {$log['id']}, Status: {$log['status']}, Items: {$log['processed_items']}/{$log['total_items']}, Created: {$log['created_at']}\n";
|
||||
if ($log['message']) {
|
||||
echo " Message: {$log['message']}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
echo "❌ Error checking database: " . $e->getMessage() . "\n";
|
||||
}
|
||||
|
||||
echo "\n✨ Database check completed!\n";
|
||||
Reference in New Issue
Block a user