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 #5 from YunoHost-Apps/language

Add Language
This commit is contained in:
Éric Gaspar 2021-06-29 00:03:24 +02:00 committed by GitHub
commit a6b78b80f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 94 deletions

View file

@ -3,6 +3,7 @@
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
admin="john" admin="john"
language="fr"
is_public=1 is_public=1
password="super_password" password="super_password"
; Checks ; Checks

View file

@ -1,21 +0,0 @@
<?php
// phpBB 3.3.x auto-generated configuration file
// Do not change anything in this file!
$dbms = 'mysqli';
$dbhost = 'localhost';
$dbport = '';
$dbname = '__DB_NAME__';
$dbuser = '__DB_NAME__';
$dbpasswd ='__DB_PWD__';
$table_prefix = 'phpbb_';
$acm_type = 'file';
$load_extensions = '';
//@define('PHPBB_INSTALLED', true);
//define('PHPBB_INSTALLED', true);
//@define('PHPBB_DISPLAY_LOAD_TIME', true);
//@define('PHPBB_ENVIRONMENT', 'production');
//@define('DEBUG_CONTAINER', true);
//@define('DEBUG', true);
//@define('EXTRA_DEBUG', true);
?>

View file

@ -5,7 +5,7 @@ installer:
email: __EMAIL__ email: __EMAIL__
board: board:
lang: en lang: __LANGUAGE__
name: My Board name: My Board
description: My amazing new phpBB board description: My amazing new phpBB board
@ -30,9 +30,9 @@ installer:
server: server:
cookie_secure: true cookie_secure: true
server_protocol: https:// server_protocol: https://
force_server_vars: false force_server_vars: true
server_name: __DOMAIN__ server_name: __DOMAIN__
server_port: 80 server_port: 443
script_path: __PATH_URL__ script_path: __PATH_URL__
extensions: ['phpbb/viglink'] extensions: ['phpbb/viglink']

View file

@ -9,12 +9,13 @@ location __PATH__/ {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
index index.php; # phpBB uses index.htm
index index.php index.html index.htm;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M; #client_max_body_size 50M;
try_files $uri $uri/ index.php; try_files $uri $uri/ @rewriteapp;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
@ -26,6 +27,18 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
# Deny access to internal phpbb files.
location ~ __PATH__/(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {
deny all;
# deny was ignored before 0.8.40 for connections over IPv6.
# Use internal directive to prohibit access on older versions.
internal;
}
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

View file

@ -0,0 +1,3 @@
updater:
type: all
extensions: ['phpbb/viglink']

View file

@ -48,6 +48,16 @@
"type": "boolean", "type": "boolean",
"default": true "default": true
}, },
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"default": "fr"
},
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user",

View file

@ -19,60 +19,3 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-fpm
#================================================= #=================================================
# FUTURE OFFICIAL HELPERS # FUTURE OFFICIAL HELPERS
#================================================= #=================================================
# Send an email to inform the administrator
#
# usage: ynh_send_readme_to_admin app_message [recipients]
# | arg: app_message - The message to send to the administrator.
# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root
# example: "root admin@domain"
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
# example: "root admin@domain user1 user2"
ynh_send_readme_to_admin() {
local app_message="${1:-...No specific information...}"
local recipients="${2:-root}"
# Retrieve the email of users
find_mails () {
local list_mails="$1"
local mail
local recipients=" "
# Read each mail in argument
for mail in $list_mails
do
# Keep root or a real email address as it is
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
then
recipients="$recipients $mail"
else
# But replace an user name without a domain after by its email
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
then
recipients="$recipients $mail"
fi
fi
done
echo "$recipients"
}
recipients=$(find_mails "$recipients")
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` has important message for you"
local mail_message="This is an automated message from your beloved YunoHost server.
Specific information for the application $app.
$app_message
---
Automatic diagnosis data from YunoHost
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
# Define binary to use for mail command
if [ -e /usr/bin/bsd-mailx ]
then
local mail_bin=/usr/bin/bsd-mailx
else
local mail_bin=/usr/bin/mail.mailutils
fi
# Send the email to the recipients
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
}

View file

@ -25,6 +25,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
password=$YNH_APP_ARG_PASSWORD password=$YNH_APP_ARG_PASSWORD
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -47,6 +48,7 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url 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=admin --value=$admin
ynh_app_setting_set --app=$app --key=language --value=$language
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -95,6 +97,7 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
tmpdir="$(mktemp -d)" tmpdir="$(mktemp -d)"
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$tmpdir" --source_id=fr ynh_setup_source --dest_dir="$tmpdir" --source_id=fr
cp -a "$tmpdir/language/fr" "$final_path/language/fr" cp -a "$tmpdir/language/fr" "$final_path/language/fr"
@ -169,17 +172,6 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# SEND A README FOR THE ADMIN
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
message="phpBB was successfully installed :)
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"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -22,6 +22,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
language=$(ynh_app_setting_get --app=$app --key=language)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION