Files
weval-l99/wire_maturity_simple.py
2026-04-20 14:13:48 +02:00

25 lines
670 B
Python

#!/usr/bin/env python3
path = "/var/www/html/api/wevia-v64-departments-kpi.php"
with open(path, "rb") as f:
raw = f.read()
# Replace 5 occurrences in order using index-based
vars_order = [b"$_wm_safe", b"$_wm_agile", b"$_wm_lean6s", b"$_wm_pmi", b"$_wm_dora"]
target = b"'maturity_pct' => 100,"
patched = 0
pos = 0
for var in vars_order:
idx = raw.find(target, pos)
if idx < 0:
break
replacement = b"'maturity_pct' => " + var + b","
raw = raw[:idx] + replacement + raw[idx+len(target):]
pos = idx + len(replacement)
patched += 1
with open(path, "wb") as f:
f.write(raw)
print(f"Patched {patched}/5")
print(f"Size: {len(raw)}")