Push composer stuff out of other function

This commit is contained in:
Luke Murphy 2020-10-15 18:11:54 +02:00
parent 9820952cbc
commit b0c5673cc0
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 10 additions and 7 deletions

View File

@ -2,6 +2,15 @@
set -eu -o pipefail
init_php() {
if ! type composer > /dev/null 2>&1; then
apt update && apt install -y curl git unzip
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.15
composer -V
fi
}
init_db() {
set -eu
@ -9,13 +18,6 @@ init_db() {
apt update && apt install -y mariadb-client
fi
if ! type composer > /dev/null 2>&1; then
apt update && apt install -y curl git unzip
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=1.10.15
composer -V
fi
PASSWORD=$(cat /run/secrets/db_password)
TABLE_COUNT=$(mysql -u "${DB_USER}" --password="$PASSWORD" -h "${DB_HOST}" "${DB_NAME}" -e "SELECT count(*) AS TOTAL FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'mediawiki';" -N -B)
@ -48,6 +50,7 @@ main() {
install_extensions
init_db
init_php
}
main