|
| 1 | +# setup.sh - Customisations Team |
| 2 | +# Commands to install and configure phpBB |
| 3 | +echo "[Codespaces] Customisations Team configuration..." |
| 4 | + |
| 5 | +# Start MySQL |
| 6 | +echo "[Codespaces] Start MySQL" |
| 7 | +sudo service mysql start |
| 8 | + |
| 9 | +# Start Apache |
| 10 | +echo "[Codespaces] Start Apache" |
| 11 | +sudo apache2ctl start |
| 12 | + |
| 13 | +# Create a MySQL user to use |
| 14 | +echo "[Codespaces] Create MySQL user" |
| 15 | +sudo mysql -u root<<EOFMYSQL |
| 16 | + CREATE USER 'phpbb'@'localhost' IDENTIFIED BY 'phpbb'; |
| 17 | + GRANT ALL PRIVILEGES ON *.* TO 'phpbb'@'localhost' WITH GRANT OPTION; |
| 18 | + CREATE DATABASE IF NOT EXISTS phpbb; |
| 19 | +EOFMYSQL |
| 20 | + |
| 21 | +# Symlink the webroot so it can be viewed |
| 22 | +echo "[Codespaces] Create Symlink of webroot" |
| 23 | +sudo rm -rf /var/www/html |
| 24 | +sudo ln -s /workspaces/phpbb/phpBB /var/www/html |
| 25 | + |
| 26 | +# Force the server URL to reflect the Codespace |
| 27 | +# https://docs.github.com/en/codespaces/developing-in-a-codespace/default-environment-variables-for-your-codespace |
| 28 | +if [ "$CODESPACES" = true ] ; then |
| 29 | + cp /workspaces/phpbb/.devcontainer/customisations-team/phpbb-config.yml /tmp/phpbb-config.yml |
| 30 | + CODESPACES_URL="${CODESPACE_NAME}-80.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" |
| 31 | + echo "[Codespaces] Set the phpBB server name using default environment variables: $CODESPACES_URL" |
| 32 | + sed -i "s/localhost/$CODESPACES_URL/g" /tmp/phpbb-config.yml |
| 33 | +fi |
| 34 | + |
| 35 | +URL_EPV="https://github.com/phpbb/epv" |
| 36 | +URL_TV="https://github.com/phpbb/phpbb-translation-validator" |
| 37 | +URL_TITANIA="https://github.com/phpbb/customisation-db.git" |
| 38 | + |
| 39 | +# Install Titania |
| 40 | +echo "[Codespaces] Install Titania" |
| 41 | +cd /workspaces/ |
| 42 | +git clone -b oberon $URL_TITANIA titania |
| 43 | +cd /workspaces/titania |
| 44 | +chmod 755 files store |
| 45 | +composer install --no-interaction |
| 46 | +chmod 755 /workspaces/phpbb/phpBB/ext |
| 47 | +mkdir /workspaces/phpbb/phpBB/ext/phpbb |
| 48 | +sudo ln -s /workspaces/titania /workspaces/phpbb/phpBB/ext/phpbb/titania |
| 49 | + |
| 50 | +# Install EPV |
| 51 | +echo "[Codespaces] Install EPV" |
| 52 | +cd /workspaces/ |
| 53 | +git clone -b master $URL_EPV epv |
| 54 | +cd /workspaces/epv |
| 55 | +composer install --no-interaction |
| 56 | +rm -rf /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/epv |
| 57 | +sudo ln -s /workspaces/epv /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/epv |
| 58 | + |
| 59 | +# Install Translation Validator |
| 60 | +echo "[Codespaces] Install Translation Validator" |
| 61 | +cd /workspaces/ |
| 62 | +git clone -b master $URL_TV translation-validator |
| 63 | +cd /workspaces/translation-validator |
| 64 | +composer install --no-interaction |
| 65 | +rm -rf /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/translation-validator |
| 66 | +sudo ln -s /workspaces/translation-validator /workspaces/phpbb/phpBB/ext/phpbb/titania/vendor/phpbb/translation-validator |
| 67 | + |
| 68 | +# Install phpBB (last so that the extension is auto-installed) |
| 69 | +echo "[Codespaces] Run phpBB CLI installation" |
| 70 | +cd /workspaces/phpbb/phpBB && composer install --no-interaction |
| 71 | +sudo php /workspaces/phpbb/phpBB/install/phpbbcli.php install /tmp/phpbb-config.yml |
| 72 | +rm -rf /workspaces/phpbb/phpBB/install |
| 73 | + |
| 74 | +# Set to debug mode |
| 75 | +sed -i \ |
| 76 | + -e "s|@define('PHPBB_ENVIRONMENT', 'production');|@define('PHPBB_ENVIRONMENT', 'development');|" \ |
| 77 | + -e "s|// *@define('DEBUG_CONTAINER', true);|@define('DEBUG_CONTAINER', true);|" \ |
| 78 | + /workspaces/phpbb/phpBB/config.php |
| 79 | + |
| 80 | +# Finished |
| 81 | +echo "[Codespaces] phpBB (Customisation Team) installation completed" |
0 commit comments