#!/bin/bash
# simplified script for reproducing issue https://forge.typo3.org/issues/98126
# Sybille Peters 2022-12-05

default="https://t3coredev11/styleguide-demo-457/test-2/forge-bugs/bug-98126-open-page-caching-does-not-work-as-expected-on-multi-language-sites"
trans="https://t3coredev11/styleguide-demo-457/de/test-2/forge-bugs/translate-to-styleguide-demo-language-german-bug-98126-open-page-caching-does-not-work-as-expected-on-multi-language-sites"


function load_url() {
  curl -sI "$1" | grep X-TYPO3-Debug-Cache > /dev/null
  if [ $? -eq 0 ];then
    echo "loaded from cache"
  else
    echo "NOT loaded from cache or error"
  fi  
  echo "------------------"
}

echo "1 load default"
load_url "$default"

echo "2 load default (repeat)"
load_url "$default"


echo "3 load translation"
load_url "$trans"

echo "4 load translation (repeat)"
load_url "$trans"


echo "5 load default"
load_url "$default"

echo "6 load default (repeat)"
load_url "$default"

