#!/usr/bin/env python3 """V125 - Widen dashboards-registry patterns to include admin + monitor pages""" path = "/var/www/html/api/dashboards-registry.php" with open(path, "r", encoding="utf-8") as f: c = f.read() if "V125-WIDEN" in c: print("ALREADY") exit(0) old = "$patterns = ['*dashboard*.html', '*-hub.html', '*-live.html', 'kpi-*.html', 'visual-*.html'];" new = "$patterns = ['*dashboard*.html', '*-hub.html', '*-live.html', 'kpi-*.html', 'visual-*.html', 'admin-*.html', '*monitor*.html', '*report*.html']; // V125-WIDEN" assert old in c, "anchor missing" c = c.replace(old, new, 1) # Update categorize to handle admin + monitor categories old_cat = """ if (strpos($n,'dormant')!==false || strpos($n,'orphan')!==false) return ['cleanup','🗑','#94a3b8']; return ['other','📄','#6b7280']; }""" new_cat = """ if (strpos($n,'dormant')!==false || strpos($n,'orphan')!==false) return ['cleanup','🗑','#94a3b8']; if (strpos($n,'admin')!==false) return ['admin','🔒','#dc2626']; if (strpos($n,'monitor')!==false || strpos($n,'health')!==false || strpos($n,'status')!==false) return ['monitor','🔍','#0ea5e9']; if (strpos($n,'report')!==false || strpos($n,'analytics')!==false) return ['report','📃','#7c3aed']; return ['other','📄','#6b7280']; }""" if old_cat in c: c = c.replace(old_cat, new_cat, 1) with open(path, "w", encoding="utf-8") as f: f.write(c) print(f"PATCHED size={len(c)}")