/dev/null; sudo crontab -l 2>/dev/null | grep..." // Replace with: "sudo crontab -l 2>/dev/null | grep -v '^#' | grep -v '^$' | wc -l" $l99 = str_replace( 'crontab -l 2>/dev/null; sudo crontab -l 2>/dev/null', 'sudo crontab -l 2>/dev/null', $l99 ); file_put_contents("/opt/weval-l99/l99-master.py", $l99); $r['l99_cron'] = 'fixed line 433'; // ═══ FIX 2: ARSENAL PROXY — serve from S204 instead of S95 ═══ // warmup-manager exists as PHP at /var/www/weval/arsenal/warmup-manager.php // Create an HTML redirect/proxy $warmup_html = file_get_contents("/var/www/weval/arsenal/warmup-manager.php"); if ($warmup_html) { file_put_contents("/var/www/html/warmup-manager.html", $warmup_html); $r['arsenal'] = 'warmup-manager.html created from PHP source'; } else { // Create simple placeholder $html = 'Warmup Manager

🔥 Warmup Manager

Service intégré dans WEVADS Arsenal.

→ Accéder à WEVADS IA

'; file_put_contents("/var/www/html/warmup-manager.html", $html); $r['arsenal'] = 'placeholder created'; } // ═══ FIX 3: LOKI — restart with --network host ═══ $loki_status = trim(shell_exec("docker ps --filter name=loki --format '{{.Status}}' 2>/dev/null")); if (!$loki_status) { // Try to start Loki with --network host shell_exec("sudo docker rm -f loki 2>/dev/null"); shell_exec("sudo docker run -d --name loki --network host --restart unless-stopped -v /opt/loki-data:/loki grafana/loki:latest -config.file=/etc/loki/local-config.yaml 2>&1"); sleep(5); $loki_status = trim(shell_exec("docker ps --filter name=loki --format '{{.Status}}' 2>/dev/null")); $r['loki'] = $loki_status ?: 'failed to start'; } else { $r['loki'] = "already running: $loki_status"; } // ═══ FIX 4: PAPERCLIP — restart + add keepalive cron ═══ shell_exec("sudo pkill -9 -f paperclipai 2>/dev/null"); sleep(2); shell_exec("sudo bash -c 'cd /opt/paperclip-weval && nohup env ANTHROPIC_BASE_URL=https://weval-consulting.com/api/wevia-anthropic.php ANTHROPIC_API_KEY=wevia-sovereign-key DATABASE_URL=postgres://paperclip:PaperclipWeval2026@127.0.0.1:5432/paperclip PORT=3100 npx paperclipai run >> /var/log/paperclip.log 2>&1 &'"); sleep(8); $pc_http = (int)trim(shell_exec("curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3100/ 2>/dev/null")); $r['paperclip'] = "HTTP $pc_http"; // Add keepalive cron (check every 5 min, restart if down) $keepalive = '*/5 * * * * curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:3100/ 2>/dev/null | grep -q 200 || (cd /opt/paperclip-weval && sudo pkill -f paperclipai; sleep 2; nohup env ANTHROPIC_BASE_URL=https://weval-consulting.com/api/wevia-anthropic.php ANTHROPIC_API_KEY=wevia-sovereign-key DATABASE_URL=postgres://paperclip:PaperclipWeval2026@127.0.0.1:5432/paperclip PORT=3100 npx paperclipai run >> /var/log/paperclip.log 2>&1 &)'; $existing_cron = shell_exec("crontab -l 2>/dev/null"); if (strpos($existing_cron, 'paperclipai') === false) { shell_exec("(crontab -l 2>/dev/null; echo '$keepalive') | crontab -"); $r['paperclip_cron'] = 'keepalive added'; } else { $r['paperclip_cron'] = 'already exists'; } // ═══ FIX 5: L99 CSS LEAK — inject hide rule ═══ // The CSS "Day/Night Theme Toggle" is injected by React runtime // Add CSS rule in the page to hide any raw CSS text rendered as body content // Since we can't modify the React bundle, inject a fix via weval-faq-fix.js $faq = file_get_contents("/var/www/html/weval-faq-fix.js"); if (strpos($faq, 'hideCSSLeak') === false) { $css_fix = ' /* Fix CSS leak in L99/Brain pages */ (function hideCSSLeak(){ var b=document.body; if(!b)return; var nodes=b.childNodes; for(var i=0;i-1){ n.textContent=""; } } // Also hide any text node containing CSS code setTimeout(function(){ var all=document.querySelectorAll("body > *"); for(var j=0;j-1 && el.textContent.indexOf("{")>-1) { el.style.display="none"; } } },500); })(); '; file_put_contents("/var/www/html/weval-faq-fix.js", $faq . $css_fix); $r['css_leak'] = 'hide fix injected in faq-fix.js'; } else { $r['css_leak'] = 'already fixed'; } // ═══ FIX 6: OPCACHE RESET ═══ opcache_reset(); $r['opcache'] = 'reset'; // ═══ VERIFY ═══ sleep(2); $checks = [ 'paperclip' => (int)trim(shell_exec("curl -s -o /dev/null -w '%{http_code}' http://127.0.0.1:3100/ 2>/dev/null")), 'wedroid' => (int)trim(shell_exec("curl -s -o /dev/null -w '%{http_code}' 'https://weval-consulting.com/api/wedroid-brain-api.php?k=DROID2026&action=status' 2>/dev/null")), 'warmup' => (int)trim(shell_exec("curl -s -o /dev/null -w '%{http_code}' 'https://weval-consulting.com/warmup-manager.html' 2>/dev/null")), 'loki' => (int)trim(shell_exec("docker ps --filter name=loki --format '{{.Status}}' 2>/dev/null | wc -c")), 'docker_total' => (int)trim(shell_exec("docker ps --format '{{.Names}}' | wc -l")), ]; $r['verify'] = $checks; echo json_encode(["ok"=>true, "results"=>$r], JSON_PRETTY_PRINT); unlink(__FILE__);