#!/bin/bash
# Ajoute les nouvelles pages statiques à la liste $PATCH_FILES de avis-google.php (sans toucher à la clé API).
cd ~/www || exit 1
cp avis-google.php avis-google.php.bak
for f in avocat-droit-immobilier-lille avocat-expulsion-locataire-lille avocat-licenciement-economique-lille avocat-harcelement-moral-travail-lille juriste-freelance-lille; do
  if grep -q "'$f/index.html'" avis-google.php; then echo "deja present: $f"; else
    sed -i "s#^\(\s*\)'avocat-droit-du-travail-lille/index.html'\(,\?\)#\1'avocat-droit-du-travail-lille/index.html',\n\1'$f/index.html'\2#" avis-google.php
    echo "ajoute: $f"
  fi
done
php -l avis-google.php && sed -n '/PATCH_FILES = array/,/);/p' avis-google.php
