Deploy: DB-Verbindung vor Upload pruefen (falscher DB_HOST brach die App), Warnung beim Anlegen-Formular behoben
This commit is contained in:
parent
ccfc257bbf
commit
27a267893e
3 changed files with 17 additions and 2 deletions
|
|
@ -548,7 +548,7 @@ function character_form_values(array $source): array
|
|||
));
|
||||
$values['hp_max'] = max(1, post_int('hp_max', (int) ($source['hp_max'] ?? 1)));
|
||||
$values['hp_current'] = post_int('hp_current', (int) ($source['hp_current'] ?? $values['hp_max']));
|
||||
$acRaw = post_string('ac', $source['ac'] === null ? '' : (string) $source['ac']);
|
||||
$acRaw = post_string('ac', ($source['ac'] ?? null) === null ? '' : (string) $source['ac']);
|
||||
$values['ac'] = $acRaw === '' ? null : max(-10, min(30, (int) $acRaw));
|
||||
$values['attack_bonus'] = post_int('attack_bonus', (int) ($source['attack_bonus'] ?? 0));
|
||||
$values['gold_coins'] = post_int('gold_coins', (int) ($source['gold_coins'] ?? 0));
|
||||
|
|
|
|||
|
|
@ -99,6 +99,18 @@ return [
|
|||
open(path, "w", encoding="utf-8").write(content)
|
||||
PY
|
||||
|
||||
# Vorab-Check: Akzeptiert der DB-Server diese Zugangsdaten? Sonst würde der
|
||||
# Upload eine vorher laufende App mit einer toten config.local.php ersetzen.
|
||||
if command -v mysql >/dev/null 2>&1; then
|
||||
DB_HOST_CLEAN="$(printf '%s' "${DB_HOST}" | tr -d '[:space:]')"
|
||||
if ! MYSQL_PWD="${DB_PASSWORD}" mysql -h "${DB_HOST_CLEAN}" -u "${DB_USER}" \
|
||||
--connect-timeout=8 -e 'SELECT 1' "${DB_NAME}" >/dev/null 2>&1; then
|
||||
echo "FEHLER: DB-Verbindung zu ${DB_USER}@${DB_HOST_CLEAN}/${DB_NAME} schlägt fehl." >&2
|
||||
echo " DB_HOST in credentials.txt prüfen (richtig ist mxzh.your-database.de)." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
upload() {
|
||||
local src="$1" dst="$2"
|
||||
if [[ ${DRY_RUN} -eq 1 ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue