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 #4 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2021-06-28 22:33:45 +02:00 committed by GitHub
commit 35ec473361
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 142 additions and 23 deletions

View file

@ -4,7 +4,7 @@
path="/path"
admin="john"
is_public=1
password="pass"
password="super_password"
; Checks
pkg_linter=1
setup_sub_dir=1

7
conf/fr.src Normal file
View file

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

View file

@ -0,0 +1,38 @@
installer:
admin:
name: __ADMIN__
password: __PASSWORD__
email: __EMAIL__
board:
lang: en
name: My Board
description: My amazing new phpBB board
database:
dbms: mysqli
dbhost: ~
dbport: ~
dbuser: __DB_USER__
dbpasswd: __DB_PWD__
dbname: __DB_NAME__
table_prefix: phpbb_
email:
enabled: true
smtp_delivery : ~
smtp_host: ~
smtp_port: ~
smtp_auth: PLAIN
smtp_user: ~
smtp_pass: ~
server:
cookie_secure: true
server_protocol: https://
force_server_vars: false
server_name: __DOMAIN__
server_port: 80
script_path: __PATH_URL__
extensions: ['phpbb/viglink']

1
conf/phpbb.cron Normal file
View file

@ -0,0 +1 @@
* * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/bin/phpbbcli.php cron:run

View file

@ -52,6 +52,12 @@ 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
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================

View file

@ -90,6 +90,18 @@ 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
ynh_setup_source --dest_dir="$tmpdir" --source_id=fr
cp -a "$tmpdir/language/fr" "$final_path/language/fr"
cp -a "$tmpdir/styles/prosilver/theme/fr" "$final_path/styles/prosilver/theme/fr"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -106,21 +118,28 @@ 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 CURL
# SETUP APPLICATION WITH CLI
#=================================================
# Set the app as temporarily public for curl call
ynh_script_progression --message="Configuring SSOwat..." --weight=1
# Making the app public for curl
ynh_permission_update --permission="main" --add="visitors"
ynh_script_progression --message="Configuring the APP..." --weight=1
# Installation with curl
ynh_script_progression --message="Finalizing installation..." --weight=1
ynh_local_curl "/install/app.php" "admin_name=$admin" "board_email=$email" "admin_pass1=$password" "admin_pass2=$password"
ynh_add_config --template="$YNH_APP_BASEDIR/conf/install-config.yml.default" --destination="$final_path/install/install-config.yml"
# Remove the public access
ynh_permission_update --permission="main" --remove="visitors"
ynh_exec_as "$app" php${phpversion} "$final_path/install/phpbbcli.php" -q --no-interaction install "$final_path/install/install-config.yml"
mv "$final_path/install" "$final_path/install_old"
#=================================================
# ADD A CRON JOB
#=================================================
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -141,7 +160,7 @@ then
fi
# Only the admin can access the admin panel of the app (if the app has an admin panel)
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
ynh_permission_create --permission="admin" --url="/adm" --allowed=$admin
#=================================================
# RELOAD NGINX
@ -157,15 +176,6 @@ ynh_script_progression --message="Sending a readme for the admin..."
message="phpBB was successfully installed :)
Please open your $app domain: https://$domain$path_url
Complete the registration process from the setup page displayed.
Details for MySQL database to be enterted while registration process:
Database login: $app
Database name: $app
Database password: $db_pwd
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/phpbb_ynh/issues"
ynh_send_readme_to_admin "$message"

View file

@ -67,6 +67,12 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -85,6 +85,12 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
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
#=================================================
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================

View file

@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
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)
#=================================================
# CHECK VERSION
@ -36,6 +37,12 @@ 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
}
@ -56,7 +63,7 @@ fi
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
ynh_permission_create --permission="admin" --url="/adm" --allowed=$admin
fi
#=================================================
@ -75,8 +82,26 @@ 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="$final_path"
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"
fi
chmod 750 "$final_path"
@ -99,6 +124,26 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
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
if [ -e "$final_path/install" ]; then
mv "$final_path/install" "$final_path/install_old"
fi
#=================================================
# ADD A CRON JOB
#=================================================
cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/phpbb.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================