mirror of
https://github.com/YunoHost-Apps/phpbb_ynh.git
synced 2024-09-03 19:56:36 +02:00
use phpbbcli to install/upgrade
This commit is contained in:
parent
7e2b816747
commit
651c9b3c86
3 changed files with 84 additions and 18 deletions
38
conf/install-config.yml.default
Normal file
38
conf/install-config.yml.default
Normal 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']
|
|
@ -106,18 +106,19 @@ 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"
|
||||
|
||||
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"
|
||||
|
||||
# Remove the public access
|
||||
ynh_permission_update --permission="main" --remove="visitors"
|
||||
|
@ -157,15 +158,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"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -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,17 @@ 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
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue