Add 'call-update-php-hack.sh'

This commit adds a hacky script that can manually call update.php.
This commit is contained in:
Tom Wiesing 2021-04-29 13:45:02 +02:00
parent e0dbe5b862
commit f703f9865f
No known key found for this signature in database
GPG key ID: DC1F29F2BC78AB15
4 changed files with 115 additions and 4 deletions

View file

@ -0,0 +1,36 @@
#!/bin/bash
set -e
# read the lib/shared.sh and read the slug argument.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR"
source "$DIR/lib/lib.sh"
require_slug_argument
# if the site doesn't exist, I can't open a shell.
if ! sql_bookkeep_exists "$SLUG"; then
log_error "=> Site '$SLUG' does not exist in bookeeping table. "
echo "I can't rebuild it. "
exit 1
fi;
# Read everything from the database
read -r INSTANCE_BASE_DIR MYSQL_DATABASE MYSQL_USER GRAPHDB_REPO GRAPHDB_USER <<< "$(sql_bookkeep_load "${SLUG}" "filesystem_base,sql_database,sql_user,graphdb_repository,graphdb_user" | tail -n +2)"
# cd into the right directory
cd "$INSTANCE_BASE_DIR"
log_info " => Enabling 'update.php' access"
docker-compose exec barrel bash /utils/settings_php_set.sh update_free_access true
log_info " => Calling update.php"
IP=`docker-compose exec barrel awk 'END{print $1}' /etc/hosts | tr -d '\r'`
URL="http://$IP:8080/update.php/selection"
# TODO: This should really call update.php sensibly
curl -H "Host: $INSTANCE_DOMAIN" $URL
log_info "=> Disabling update.php access"
docker-compose exec barrel bash /utils/settings_php_set.sh update_free_access false