mirror of
https://github.com/YunoHost-Apps/phpbb_ynh.git
synced 2024-09-03 19:56:36 +02:00
commit
3caf38f685
8 changed files with 123 additions and 23 deletions
|
@ -4,7 +4,7 @@
|
|||
path="/path"
|
||||
admin="john"
|
||||
is_public=1
|
||||
password="pass"
|
||||
password="super_password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
|
|
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']
|
1
conf/phpbb.cron
Normal file
1
conf/phpbb.cron
Normal file
|
@ -0,0 +1 @@
|
|||
* * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/bin/phpbbcli.php cron:run
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -118,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
|
||||
|
@ -153,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
|
||||
|
@ -169,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"
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue