From 0f313ee4521cdbafdb662e86db19bf625e697b3d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 28 Jun 2021 15:50:55 +0200 Subject: [PATCH 1/6] mv --- doc/DISCLAIMER.md | 2 +- doc/DISCLAIMER_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index fc803a6..18ec27c 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -2,4 +2,4 @@ 1. The app will require to complete the registration process after the instllation is complete by **visiting the domain** on which *phpBB* is installed. 1. The MySQL database credentials will be sent to the **admin mail**. -1. Please delete, move or rename the install directory (`sudo rm -R /var/www/phpbb/install`) before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible. +1. Please delete, move or rename the install directory (`mv /var/www/phpbb/install /var/www/phpbb/install_old`) before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md index 00c0d20..dfe8b30 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/DISCLAIMER_fr.md @@ -2,4 +2,4 @@ 1. L'application devra terminer le processus d'enregistrement une fois l'installation terminée en **visitant le domaine** sur lequel *phpBB* est installé. 1. Les informations d'identification de la base de données MySQL seront envoyées à la **messagerie admin**. -1. Veuillez supprimer, déplacer ou renommer le répertoire d'installation (`sudo rm -R /var/www/phpbb/install`) avant d'utiliser votre forum. Si ce répertoire est toujours présent, seul le panneau de configuration d'administration (ACP) sera accessible. \ No newline at end of file +1. Veuillez supprimer, déplacer ou renommer le répertoire d'installation (`mv /var/www/phpbb/install /var/www/phpbb/install_old`) avant d'utiliser votre forum. Si ce répertoire est toujours présent, seul le panneau de configuration d'administration (ACP) sera accessible. \ No newline at end of file From 7e2b81674787362a95fdf4416a6226150232424b Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 28 Jun 2021 13:51:02 +0000 Subject: [PATCH 2/6] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6644a62..cfc9213 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Forum software that is easy to use, powerful, and highly customisable 1. The app will require to complete the registration process after the instllation is complete by **visiting the domain** on which *phpBB* is installed. 1. The MySQL database credentials will be sent to the **admin mail**. -1. Please delete, move or rename the install directory (`sudo rm -R /var/www/phpbb/install`) before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible. +1. Please delete, move or rename the install directory (`mv /var/www/phpbb/install /var/www/phpbb/install_old`) before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible. ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 93baaad..d80c121 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ Forum facile à utiliser, puissant et hautement personnalisable 1. L'application devra terminer le processus d'enregistrement une fois l'installation terminée en **visitant le domaine** sur lequel *phpBB* est installé. 1. Les informations d'identification de la base de données MySQL seront envoyées à la **messagerie admin**. -1. Veuillez supprimer, déplacer ou renommer le répertoire d'installation (`sudo rm -R /var/www/phpbb/install`) avant d'utiliser votre forum. Si ce répertoire est toujours présent, seul le panneau de configuration d'administration (ACP) sera accessible. +1. Veuillez supprimer, déplacer ou renommer le répertoire d'installation (`mv /var/www/phpbb/install /var/www/phpbb/install_old`) avant d'utiliser votre forum. Si ce répertoire est toujours présent, seul le panneau de configuration d'administration (ACP) sera accessible. ## Documentations et ressources * Site officiel de l'app : http://www.phpbb.com/ From 651c9b3c860b58f6e22770ad7d671533a23eac47 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 28 Jun 2021 17:25:52 +0200 Subject: [PATCH 3/6] use phpbbcli to install/upgrade --- conf/install-config.yml.default | 38 +++++++++++++++++++++++++++++++++ scripts/install | 26 ++++++++-------------- scripts/upgrade | 38 ++++++++++++++++++++++++++++++++- 3 files changed, 84 insertions(+), 18 deletions(-) create mode 100644 conf/install-config.yml.default diff --git a/conf/install-config.yml.default b/conf/install-config.yml.default new file mode 100644 index 0000000..5359d66 --- /dev/null +++ b/conf/install-config.yml.default @@ -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'] \ No newline at end of file diff --git a/scripts/install b/scripts/install index 395554a..d3a07cf 100644 --- a/scripts/install +++ b/scripts/install @@ -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" diff --git a/scripts/upgrade b/scripts/upgrade index 11c9833..b1ee5c5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #================================================= From cd50f8c353b9c5161063a5452cff4d0fe25f9122 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 28 Jun 2021 17:26:30 +0200 Subject: [PATCH 4/6] fix the permission url --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index d3a07cf..683943c 100644 --- a/scripts/install +++ b/scripts/install @@ -142,7 +142,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 diff --git a/scripts/upgrade b/scripts/upgrade index b1ee5c5..2cdd2a8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,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 #================================================= From 4f8f242cad7c792b2d20e3092a60083e6bc7df4e Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 28 Jun 2021 17:26:43 +0200 Subject: [PATCH 5/6] add a cron task --- conf/phpbb.cron | 1 + scripts/backup | 6 ++++++ scripts/install | 10 ++++++++-- scripts/remove | 6 ++++++ scripts/restore | 6 ++++++ scripts/upgrade | 9 +++++++++ 6 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 conf/phpbb.cron diff --git a/conf/phpbb.cron b/conf/phpbb.cron new file mode 100644 index 0000000..469dc1b --- /dev/null +++ b/conf/phpbb.cron @@ -0,0 +1 @@ +* * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/bin/phpbbcli.php cron:run \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index b93a5ca..b6cad37 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 #================================================= diff --git a/scripts/install b/scripts/install index 683943c..3fb4d4e 100644 --- a/scripts/install +++ b/scripts/install @@ -120,8 +120,14 @@ ynh_exec_as "$app" php${phpversion} "$final_path/install/phpbbcli.php" -q --no-i mv "$final_path/install" "$final_path/install_old" -# Remove the public access -ynh_permission_update --permission="main" --remove="visitors" +#================================================= +# 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 diff --git a/scripts/remove b/scripts/remove index 6c5e664..63b1d85 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 #================================================= diff --git a/scripts/restore b/scripts/restore index 3feec35..cbf519f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2cdd2a8..4bc02a1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -135,6 +135,15 @@ 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 #================================================= From c3f80c98a60f754a066303610d55d03b9d96698a Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 28 Jun 2021 18:32:55 +0200 Subject: [PATCH 6/6] fix tests --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 78f1741..8c4f6f9 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ path="/path" admin="john" is_public=1 - password="pass" + password="super_password" ; Checks pkg_linter=1 setup_sub_dir=1