mirror of
https://github.com/YunoHost-Apps/webtrees_ynh.git
synced 2024-09-03 18:26:37 +02:00
Php8 (#54)
* 2.0.14 (#24) * 2.0.14 * Update install * Upgrade to 2.0.15 (#26) * Upgrade to 2.0.15 * Update README.md * Upgrade to 2.0.16 * [autopatch] Update issue and PR templates * Attempt to fix the stupid encoding issue in LICENSE, breaking the linter * Add php7.3-zip * cleaning (#32) * Update install * Update restore * fix linter * 2.0.17 (#36) * 2.0.17 * Fix * 2.0.19 (#38) * 2.0.19 * 2.0.21 (#40) * 2.0.21 * Auto-update README Co-authored-by: yunohost-bot <yunohost@yunohost.org> * 2.0.23 * Auto-update README * 2.1.0 * Auto-update README * Update _common.sh * 2.1.1 * Auto-update README * Update _common.sh * Create updater.sh * Update updater.sh * Add change_url * Update check_process * Update upgrade * Update manifest.json * Auto-update README * Upgrade to version 2.1.2 (#45) * Upgrade to v2.1.2 * Auto-update README Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Upgrade to version 2.1.4 (#49) * Upgrade to v2.1.4 * Auto-update README Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost@yunohost.org> * 2.1.5 * Auto-update README * PHP8 * upgrade helper send to admin * Update install * Update install * Fix * Fix * Fix * Update check_process * Remove random password * Update _common.sh * Update config.ini.php * Update install * Update admin.sql * Fix * Update config.ini.php Co-authored-by: Yunohost-Bot <> Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
This commit is contained in:
parent
45834abcd4
commit
c520c022b3
9 changed files with 48 additions and 128 deletions
|
@ -2,8 +2,7 @@
|
|||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
username="john"
|
||||
name="john"
|
||||
admin="john"
|
||||
email="admin@example.com"
|
||||
is_public=1
|
||||
; Checks
|
||||
|
@ -16,6 +15,8 @@
|
|||
upgrade=1
|
||||
#2.0.23~ynh1
|
||||
upgrade=1 from_commit=ba7931d0524925cb4a4264ac857af9ea7c7e6120
|
||||
#2.1.4~ynh1
|
||||
upgrade=1 from_commit=61571b15dec769da5bf2466c5e8c56f204268bd6
|
||||
backup_restore=1
|
||||
multi_instance=1
|
||||
change_url=1
|
||||
|
@ -25,4 +26,6 @@ Notification=change
|
|||
;;; Upgrade options
|
||||
; commit=ba7931d0524925cb4a4264ac857af9ea7c7e6120
|
||||
name=Testing (#42)
|
||||
; commit=ba7931d0524925cb4a4264ac857af9ea7c7e6120
|
||||
name=Testing (#50)
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
; <?php exit; ?> DO NOT DELETE THIS LINE
|
||||
dbtype="mysql"
|
||||
dbhost="localhost"
|
||||
dbport="3306"
|
||||
dbuser="__DB_USER__"
|
||||
dbpass="__DB_PWD__"
|
||||
dbname="__DB_NAME__"
|
||||
tblpfx="wt_"
|
||||
base_url="https://__DOMAIN____PATH__"
|
||||
rewrite_urls="0"
|
||||
|
|
|
@ -25,8 +25,8 @@ location __PATH__/ {
|
|||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
# Deny access to /data/config.ini.php
|
||||
location = __PATH__/data/config.ini.php {
|
||||
deny all;
|
||||
return 404;
|
||||
}
|
||||
# Deny access to /data/config.ini.php
|
||||
location = __PATH__/data/config.ini.php {
|
||||
deny all;
|
||||
return 404;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES (NULL, '__USER_NAME__', '__NAME__', '__USER_EMAIL__', '__PASSWORD__');
|
||||
INSERT INTO `wt_user` (`user_id`, `user_name`, `real_name`, `email`, `password`) VALUES (NULL, '__ADMIN__', '__FULLNAME__', '__EMAIL__', '__SALT_PASSWORD__');
|
||||
INSERT INTO `wt_user_setting` (`user_id`, `setting_name`, `setting_value`) VALUES ('1', 'canadmin', '1'), ('1', 'verified', '1'), ('1', 'verified_by_admin', '1');
|
||||
|
||||
|
|
|
@ -41,34 +41,7 @@
|
|||
"example": "/webtrees",
|
||||
"default": "/webtrees"
|
||||
},
|
||||
{
|
||||
"name": "username",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose an admin username (Not a LDAP User)",
|
||||
"fr": "Choisissez un nom d'utilisateur pour l'administrateur de Webtrees (ne doit pas être un utilisateur YunoHost existant)"
|
||||
},
|
||||
"example": "john"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Name of the user (Not a LDAP User)",
|
||||
"fr": "Nom de cet utilisateur"
|
||||
},
|
||||
"example": "john doe"
|
||||
},
|
||||
{
|
||||
"name": "email",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Admin email (All the new registration will be sent on this email)",
|
||||
"fr": "Adresse email de l'administrateur (Toutes les nouvelles inscriptions seront envoyées à cette adresse)"
|
||||
},
|
||||
"example": "admin@example.com"
|
||||
},
|
||||
{
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
|
@ -76,6 +49,14 @@
|
|||
"fr": "Si cochée, Webtrees sera publique"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -20,56 +20,3 @@ pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php
|
|||
#=================================================
|
||||
# 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 $app.
|
||||
$app_message"
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
|
|
@ -13,6 +13,10 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -24,11 +28,11 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
admin_username=$YNH_APP_ARG_USERNAME
|
||||
admin_name=$YNH_APP_ARG_NAME
|
||||
admin_email=$YNH_APP_ARG_EMAIL
|
||||
password=$(ynh_string_random 24)
|
||||
admin_password=$(openssl passwd -1 -salt xyz $password)
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||
fullname=$(ynh_user_get_info --username=$admin --key=fullname)
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
salt_password=$(openssl passwd -1 -salt xyz $password)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -50,6 +54,7 @@ ynh_script_progression --message="Storing installation settings..."
|
|||
|
||||
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=admin --value=$admin
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
|
@ -114,16 +119,15 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
# Adding the details of the database to the config file
|
||||
ynh_add_config --template="../conf/config.ini.php" --destination="$final_path/data/config.ini.php"
|
||||
|
||||
chmod 400 "$final_path/data/config.ini.php"
|
||||
chown $app:$app "$final_path/data/config.ini.php"
|
||||
|
||||
# Load initial SQL into the new database
|
||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/webtrees.sql"
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "../conf/sql/webtrees.sql"
|
||||
|
||||
# Replace variables in sql scripts
|
||||
ynh_replace_string --match_string="__USER_NAME__" --replace_string="$admin_username" --target_file="../conf/sql/admin.sql"
|
||||
ynh_replace_string --match_string="__NAME__" --replace_string="$admin_name" --target_file="../conf/sql/admin.sql"
|
||||
ynh_replace_string --match_string="__USER_EMAIL__" --replace_string="$admin_email" --target_file="../conf/sql/admin.sql"
|
||||
ynh_replace_string --match_string="__PASSWORD__" --replace_string="$admin_password" --target_file="../conf/sql/admin.sql"
|
||||
|
||||
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "../conf/sql/admin.sql"
|
||||
ynh_add_config --template="../conf/sql/admin.sql" --destination="/var/tmp/admin.sql"
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "/var/tmp/admin.sql"
|
||||
ynh_secure_remove --file="/var/tmp/admin.sql"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -143,22 +147,6 @@ ynh_script_progression --message="Reloading NGINX web server..."
|
|||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
||||
message="Webtrees was successfully installed :)
|
||||
|
||||
Please open https://$domain$path_url
|
||||
|
||||
Your credentials for the admin panel are:
|
||||
- admin username: $admin_username
|
||||
- admin password: $password
|
||||
|
||||
If you facing an issue or want to improve Webtrees, please open a new issue in this project: https://github.com/YunoHost-Apps/webtrees_ynh"
|
||||
|
||||
ynh_send_readme_to_admin "$message"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -13,6 +13,11 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
|
@ -35,7 +40,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path || ynh_die "There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
|
|
@ -85,17 +85,9 @@ ynh_script_progression --message="Upgrading source files..."
|
|||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
# Move old app dir
|
||||
mv ${final_path} ${final_path}.old
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
# restore data
|
||||
cp -a ${final_path}.old/data ${final_path}
|
||||
|
||||
# delete temp directory
|
||||
ynh_secure_remove --file=${final_path}.old
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/data "
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
|
Loading…
Add table
Reference in a new issue