Update: 2026-07-05 18:05:08
This commit is contained in:
@@ -4,21 +4,9 @@ if (php_sapi_name() !== 'cli') {
|
||||
die("This script must be run from the command line (Terminal).\n");
|
||||
}
|
||||
|
||||
// Load .env for CLI
|
||||
$envPath = __DIR__ . '/../.env';
|
||||
if (file_exists($envPath)) {
|
||||
$lines = file($envPath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
if (strpos(trim($line), '#') === 0) continue;
|
||||
$parts = explode('=', $line, 2);
|
||||
if (count($parts) === 2) {
|
||||
putenv(trim($parts[0]) . '=' . trim($parts[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Load core bootstrap (which handles .env, dependencies, database, etc.)
|
||||
require_once __DIR__ . '/../core/bootstrap.php';
|
||||
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");
|
||||
@@ -97,6 +85,12 @@ echo "---------------------------------\n";
|
||||
echo "[*] Sending to Gemini AI for analysis...\n";
|
||||
|
||||
$gemini = new SiroGeminiService();
|
||||
|
||||
if (!getenv('GEMINI_API_KEY') && empty($_ENV['GEMINI_API_KEY'])) {
|
||||
echo "[-] ERROR: GEMINI_API_KEY is completely missing in CLI environment. Make sure your .env file exists.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
$reportHtml = $gemini->evaluateTelegramForReporting($allMessages);
|
||||
|
||||
if ($reportHtml && strpos($reportHtml, 'لا توجد بيانات مفيدة') === false) {
|
||||
|
||||
Reference in New Issue
Block a user