51 lines
1.7 KiB
PHP
Executable File
51 lines
1.7 KiB
PHP
Executable File
<?php
|
|
require_once __DIR__ . '/shared/database/connection.php';
|
|
|
|
if (file_exists(__DIR__ . '/.env')) {
|
|
$lines = file(__DIR__ . '/.env', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
|
foreach ($lines as $line) {
|
|
$line = trim($line);
|
|
if ($line === '' || strpos($line, '#') === 0) continue;
|
|
if (strpos($line, '=') === false) continue;
|
|
list($key, $value) = explode('=', $line, 2);
|
|
$_ENV[trim($key)] = trim($value);
|
|
}
|
|
}
|
|
|
|
try {
|
|
$db = getDB();
|
|
|
|
echo "=== IDIOMAS EN LA BASE DE DATOS ===\n\n";
|
|
|
|
$stmt = $db->query("SELECT * FROM idiomas ORDER BY nombre ASC");
|
|
$idiomas = $stmt->fetchAll();
|
|
|
|
echo "Total de idiomas: " . count($idiomas) . "\n";
|
|
echo "Idiomas ACTIVOS: " . count(array_filter($idiomas, fn($i) => $i['activo'] == 1)) . "\n\n";
|
|
|
|
foreach ($idiomas as $idioma) {
|
|
$estado = $idioma['activo'] ? '✅ ACTIVO' : '❌ INACTIVO';
|
|
$bandera = $idioma['bandera'] ?? '🏳️';
|
|
echo sprintf("%s %s - %s (%s) %s\n",
|
|
$bandera,
|
|
$idioma['nombre'],
|
|
$idioma['codigo'],
|
|
$idioma['nombre_nativo'] ?? 'N/A',
|
|
$estado
|
|
);
|
|
}
|
|
|
|
echo "\n=== DIAGNÓSTICO ===\n";
|
|
$activos = count(array_filter($idiomas, fn($i) => $i['activo'] == 1));
|
|
if ($activos < 2) {
|
|
echo "⚠️ PROBLEMA ENCONTRADO: Solo hay $activos idioma(s) activo(s).\n";
|
|
echo "El bot necesita AL MENOS 2 idiomas activos para ofrecer traducción.\n";
|
|
echo "\nSOLUCIÓN: Ve a /shared/languages/manager.php y activa más idiomas.\n";
|
|
} else {
|
|
echo "✅ Tienes $activos idiomas activos. Esto es suficiente.\n";
|
|
}
|
|
|
|
} catch (Exception $e) {
|
|
echo "ERROR: " . $e->getMessage() . "\n";
|
|
}
|