diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100755 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -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.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100755 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100755 index 0000000..9e7ad09 --- /dev/null +++ b/.github/workflows/updater.sh @@ -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 < 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 < 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 diff --git a/README.md b/README.md index b16a2ef..fce9cee 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in 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/ @@ -37,7 +37,6 @@ phpBB is a free flat-forum bulletin board software solution that can be used to ## 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 diff --git a/README_fr.md b/README_fr.md index 58d9adc..14a935b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour 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/ @@ -32,7 +32,6 @@ phpBB is a free flat-forum bulletin board software solution that can be used to ## 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 diff --git a/check_process b/check_process index 67b94f7..8ece525 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,7 @@ setup_private=1 setup_public=1 upgrade=1 - #upgrade=1 from_commit=CommitHash + upgrade=1 from_commit=28f03211e7354cd7a1e34ec379e06e4bda25fbeb backup_restore=1 multi_instance=1 change_url=1 @@ -22,6 +22,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. + ; commit=28f03211e7354cd7a1e34ec379e06e4bda25fbeb + name=Merge pull request #7 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/conf/app.src b/conf/app.src index f9fdc06..e2552f9 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,6 @@ -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 -SOURCE_FILENAME= SOURCE_EXTRACT=true diff --git a/conf/fr.src b/conf/fr.src index 37cdc12..dc1d3e6 100644 --- a/conf/fr.src +++ b/conf/fr.src @@ -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 diff --git a/conf/nginx.conf b/conf/nginx.conf index 449c8be..4bf80c3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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; diff --git a/manifest.json b/manifest.json index e885995..a944284 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,13 @@ "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", @@ -22,7 +21,7 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 862e440..76661c2 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ 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" +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 diff --git a/scripts/install b/scripts/install index b94b85e..ecf2532 100644 --- a/scripts/install +++ b/scripts/install @@ -50,6 +50,13 @@ 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 +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # STANDARD MODIFICATIONS #================================================= @@ -121,15 +128,12 @@ 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) - #================================================= # 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 +142,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 diff --git a/scripts/remove b/scripts/remove index 5eb5ecd..6294a38 100644 --- a/scripts/remove +++ b/scripts/remove @@ -30,6 +30,14 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=1 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=1 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 5ab7490..4eca261 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 35bc1b8..dc58bcf 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,12 +38,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 } @@ -117,6 +111,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 #================================================= @@ -130,20 +131,20 @@ ynh_add_fpm_config #================================================= 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" 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