21 lines
589 B
Python
21 lines
589 B
Python
#!/usr/bin/env python3
|
|
path = "/var/www/html/api/handlers/l99-honest-refresh.sh"
|
|
with open(path, "rb") as f:
|
|
raw = f.read()
|
|
|
|
# Bump opus timeout to allow retries + add max_execution_time
|
|
patches = [
|
|
(b"OO=$(timeout 400 php -r", b"OO=$(timeout 500 php -d max_execution_time=550 -r"),
|
|
(b"MO=$(timeout 280 php -r", b"MO=$(timeout 350 php -d max_execution_time=400 -r"),
|
|
]
|
|
count = 0
|
|
for o, n in patches:
|
|
if o in raw:
|
|
raw = raw.replace(o, n, 1)
|
|
count += 1
|
|
print(f"OK: {o[:30]}...")
|
|
|
|
with open(path, "wb") as f:
|
|
f.write(raw)
|
|
print(f"patched {count}")
|