Update: 2026-07-05 18:07:23

This commit is contained in:
Hamza-Ayed
2026-07-05 18:07:23 +03:00
parent 4c7a51053f
commit c96f457d2d
+21 -2
View File
@@ -4,9 +4,28 @@ if (php_sapi_name() !== 'cli') {
die("This script must be run from the command line (Terminal).\n");
}
// Load core bootstrap (which handles .env, dependencies, database, etc.)
require_once __DIR__ . '/../core/bootstrap.php';
// Load .env for CLI
$envPaths = [__DIR__ . '/../.env', __DIR__ . '/../../.env'];
foreach ($envPaths as $envPath) {
if (file_exists($envPath)) {
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach ($lines as $line) {
$line = trim($line);
if (empty($line) || strpos($line, '#') === 0) continue;
$parts = explode('=', $line, 2);
if (count($parts) === 2) {
$key = trim($parts[0]);
$val = trim(trim($parts[1]), "\"'");
putenv("$key=$val");
$_ENV[$key] = $val;
}
}
break;
}
}
require_once __DIR__ . '/../core/Services/SiroGeminiService.php';
require_once __DIR__ . '/../core/Database/Database.php';
if (!file_exists(__DIR__ . '/madeline.php')) {
die("Error: madeline.php not found. Please run telegram_setup.php first.\n");