1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/phpbb_ynh.git synced 2024-09-03 19:56:36 +02:00

Merge pull request #9 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2022-03-13 15:01:09 +01:00 committed by GitHub
commit 029929ec9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 321 additions and 104 deletions

55
.github/ISSUE_TEMPLATE.md vendored Executable file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Executable file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

142
.github/workflows/updater.sh vendored Executable file
View file

@ -0,0 +1,142 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"phpBB-"*".zip"*)
src="app"
;;
*"v"*".zip"*)
src="fr"
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true
EOT
cat <<EOT > conf/fr.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=phpbb-language.zip
SOURCE_EXTRACT=true
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -15,9 +15,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Forum software that is easy to use, powerful, and highly customisable
phpBB is a free flat-forum bulletin board software solution that can be used to stay in touch with a group of people or can power your entire website. With an extensive database of user-created extensions and styles database containing hundreds of style and image packages to customise your board, you can create a very unique forum in minutes.
**Shipped version:** 3.3.4~ynh3
**Shipped version:** 3.3.5~ynh1
**Demo:** https://www.phpbb.com/demo/
@ -36,7 +37,6 @@ Forum software that is easy to use, powerful, and highly customisable
## Documentation and resources
* Official app website: http://www.phpbb.com/
* Official user documentation: https://yunohost.org/apps
* Official admin documentation: https://www.phpbb.com/support/docs/
* Upstream app code repository: https://github.com/phpbb/phpbb
* YunoHost documentation for this app: https://yunohost.org/app_phpbb

View file

@ -11,9 +11,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble
Forum facile à utiliser, puissant et hautement personnalisable
phpBB is a free flat-forum bulletin board software solution that can be used to stay in touch with a group of people or can power your entire website. With an extensive database of user-created extensions and styles database containing hundreds of style and image packages to customise your board, you can create a very unique forum in minutes.
**Version incluse :** 3.3.4~ynh3
**Version incluse :** 3.3.5~ynh1
**Démo :** https://www.phpbb.com/demo/
@ -31,7 +32,6 @@ Forum facile à utiliser, puissant et hautement personnalisable
## Documentations et ressources
* Site officiel de l'app : http://www.phpbb.com/
* Documentation officielle utilisateur : https://yunohost.org/apps
* Documentation officielle de l'admin : https://www.phpbb.com/support/docs/
* Dépôt de code officiel de l'app : https://github.com/phpbb/phpbb
* Documentation YunoHost pour cette app : https://yunohost.org/app_phpbb

View file

@ -2,10 +2,10 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="fr"
is_public=1
password="super_password"
language="fr"
admin="john"
password="1Strong-Password"
; Checks
pkg_linter=1
setup_sub_dir=1
@ -14,14 +14,15 @@
setup_private=1
setup_public=1
upgrade=1
#upgrade=1 from_commit=CommitHash
# 3.3.4~ynh3
upgrade=1 from_commit=28f03211e7354cd7a1e34ec379e06e4bda25fbeb
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
; commit=28f03211e7354cd7a1e34ec379e06e4bda25fbeb
name=3.3.4~ynh3

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://download.phpbb.com/pub/release/3.3/3.3.4/phpBB-3.3.4.zip
SOURCE_SUM=7fea067567f8190ed5c84645bf535da0dca547f6c116c543bac33940824773a8
SOURCE_URL=https://download.phpbb.com/pub/release/3.3/3.3.5/phpBB-3.3.5.zip
SOURCE_SUM=983d60881fab3139bbcbe9182dcaaa1d2e9c6fb80fef682a0b28785ee22d05dd
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -1,7 +1,7 @@
SOURCE_URL=https://github.com/qiaeru/phpbb-language-fr/archive/refs/tags/v4.4.0.zip
SOURCE_SUM=c3a655a36ca7ce97ccae927850c2b4f1e1d2734558f2e08ca94bbf05e50aaafb
SOURCE_URL=https://github.com/qiaeru/phpbb-language-fr/archive/refs/tags/v4.5.0.zip
SOURCE_SUM=a959ab84d60c99cabb9353adcc2e24d9f597669c8832e6fa31afebc3cafb1b5e
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=phpbb-language-fr-4.4.0.zip
SOURCE_FILENAME=phpbb-language.zip
SOURCE_EXTRACT=true

View file

@ -4,11 +4,6 @@ location __PATH__/ {
# Path to source
alias __FINALPATH__/ ;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# phpBB uses index.htm
index index.php index.html index.htm;
@ -40,5 +35,5 @@ location __PATH__/ {
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
rewrite ^(.*)$ /app.php/$1 last;
}

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
phpBB is a free flat-forum bulletin board software solution that can be used to stay in touch with a group of people or can power your entire website. With an extensive database of user-created extensions and styles database containing hundreds of style and image packages to customise your board, you can create a very unique forum in minutes.

View file

@ -6,23 +6,22 @@
"en": "Forum software that is easy to use, powerful, and highly customisable",
"fr": "Forum facile à utiliser, puissant et hautement personnalisable"
},
"version": "3.3.4~ynh3",
"version": "3.3.5~ynh1",
"url": "http://www.phpbb.com/",
"upstream": {
"license": "GPL-2.0-only",
"website": "http://www.phpbb.com/",
"demo": "https://www.phpbb.com/demo/",
"admindoc": "https://www.phpbb.com/support/docs/",
"userdoc": "https://yunohost.org/apps",
"code": "https://github.com/phpbb/phpbb"
},
"license": "GPL-2.0-only",
"maintainer": {
"name": "",
"name": "eric_G",
"email": ""
},
"requirements": {
"yunohost": ">= 4.2.4"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
@ -34,8 +33,7 @@
"install" : [
{
"name": "domain",
"type": "domain",
"example": "example.com"
"type": "domain"
},
{
"name": "path",
@ -52,21 +50,19 @@
"name": "language",
"type": "string",
"ask": {
"en": "Choose the board language",
"fr": "Choisissez la langue du forum"
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"default": "fr"
},
{
"name": "admin",
"type": "user",
"example": "johndoe"
"type": "user"
},
{
"name": "password",
"type": "password",
"example": "Choose a password"
"type": "password"
}
]
}

View file

@ -6,7 +6,8 @@
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xmlrpc php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath"
# dependencies used by the app
pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xmlrpc php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath"
#=================================================
# PERSONAL HELPERS

View file

@ -53,7 +53,9 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE CRON FILE
# SPECIFIC BACKUP
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -26,14 +26,13 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -95,7 +94,7 @@ then
fi
#=================================================
# GENERIC FINALIZATION
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -21,11 +21,11 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
email=$(ynh_user_get_info --username=$admin --key=mail)
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
@ -47,8 +47,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
@ -61,6 +61,13 @@ ynh_script_progression --message="Finding an available port..." --weight=1
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -88,14 +95,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK LANGUAGE PACK
#=================================================
tmpdir="$(mktemp -d)"
# Download, check integrity, uncompress and patch the source from app.src
@ -105,6 +104,10 @@ cp -a "$tmpdir/styles/prosilver/theme/fr" "$final_path/styles/prosilver/theme/fr
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -120,16 +123,16 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=4
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================
# SETUP APPLICATION WITH CLI
#=================================================
ynh_script_progression --message="Configuring the APP..." --weight=1
ynh_add_config --template="$YNH_APP_BASEDIR/conf/install-config.yml.default" --destination="$final_path/install/install-config.yml"
ynh_add_config --template="../conf/install-config.yml.default" --destination="$final_path/install/install-config.yml"
ynh_exec_as "$app" php${phpversion} "$final_path/install/phpbbcli.php" -q --no-interaction install "$final_path/install/install-config.yml"
@ -138,11 +141,11 @@ mv "$final_path/install" "$final_path/install_old"
#=================================================
# ADD A CRON JOB
#=================================================
ynh_script_progression --message="Setuping a cron..." --weight=1
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_add_config --template="../conf/phpbb.cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# SETUP SSOWAT

View file

@ -22,6 +22,8 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
@ -55,8 +57,19 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
ynh_remove_fpm_config
#=================================================
# REMOVE THE CRON FILE
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -20,7 +20,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -36,8 +36,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -46,7 +44,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -56,7 +54,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
@ -76,6 +74,14 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
@ -86,8 +92,9 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE CRON FILE
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app"

View file

@ -18,15 +18,16 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
language=$(ynh_app_setting_get --app=$app --key=language)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -38,12 +39,6 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
if [ -n "$new_phpbb_dir" ]; then
ynh_secure_remove --file="$new_phpbb_dir"
fi
if [ -n "$old_phpbb_dir" ]; then
ynh_secure_remove --file="$old_phpbb_dir"
fi
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -83,26 +78,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=5
new_phpbb_dir=$(mktemp -d)
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$new_phpbb_dir"
ynh_secure_remove --file="$new_phpbb_dir/config.php"
ynh_secure_remove --file="$new_phpbb_dir/images"
ynh_secure_remove --file="$new_phpbb_dir/files"
ynh_secure_remove --file="$new_phpbb_dir/store"
old_phpbb_dir=$(mktemp -d)
mv $final_path/* $old_phpbb_dir
mv $old_phpbb_dir/config.php $final_path/
mv $old_phpbb_dir/images/ $final_path/
mv $old_phpbb_dir/files/ $final_path/
mv $old_phpbb_dir/store/ $final_path/
mv $new_phpbb_dir/* $final_path
ynh_secure_remove --file="$old_phpbb_dir"
ynh_secure_remove --file="$new_phpbb_dir"
ynh_setup_source --dest_dir="$final_path" --keep="config.php images/ files/ store/"
fi
chmod 750 "$final_path"
@ -117,6 +94,13 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -126,24 +110,26 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
ynh_add_fpm_config
#=================================================
# PHP-FPM CONFIGURATION
# SPECIFIC UPGRADE
#=================================================
ynh_script_progression --message="Upgrading the APP..." --weight=1
# UPGRADE APP
#=================================================
ynh_script_progression --message="Upgrading the $app..." --weight=1
ynh_exec_as "$app" php${phpversion} "$final_path/bin/phpbbcli.php" -q --no-interaction db:migrate
ynh_exec_as $app php${phpversion} "$final_path/bin/phpbbcli.php" --no-interaction db:migrate --safe-mode
if [ -e "$final_path/install" ]; then
mv "$final_path/install" "$final_path/install_old"
ynh_exec_as $app mv "$final_path/install" "$final_path/install_old"
fi
#=================================================
# ADD A CRON JOB
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..." --weight=1
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_add_config --template="../conf/phpbb.cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# RELOAD NGINX