mirror of
https://github.com/YunoHost-Apps/limesurvey_ynh.git
synced 2024-09-03 19:36:32 +02:00
Update _common.sh
This commit is contained in:
parent
7305f92862
commit
33c7841922
1 changed files with 0 additions and 76 deletions
|
@ -15,7 +15,6 @@ pkg_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mysql php${YNH
|
|||
#=================================================
|
||||
set_permissions () {
|
||||
|
||||
ynh_set_default_perm $final_path
|
||||
find $final_path -type f -name "*.php" -print0 | xargs -0 chmod 400 \
|
||||
|| echo "No file to modify"
|
||||
#chown root: $final_path/application/config/config.php
|
||||
|
@ -28,81 +27,6 @@ set_permissions () {
|
|||
# COMMON HELPERS
|
||||
#=================================================
|
||||
|
||||
ynh_set_default_perm () {
|
||||
local DIRECTORY=$1
|
||||
# Set permissions
|
||||
chown -R $app:www-data $DIRECTORY
|
||||
chmod -R 440 $DIRECTORY
|
||||
find $DIRECTORY -type d -print0 | xargs -0 chmod 550 \
|
||||
|| echo "No file to modify"
|
||||
|
||||
}
|
||||
|
||||
# Save listed var in YunoHost app settings
|
||||
# usage: ynh_save_args VARNAME1 [VARNAME2 [...]]
|
||||
ynh_save_args () {
|
||||
for var in $@;
|
||||
do
|
||||
local setting_var="$var"
|
||||
if [ "$var" == "path_url" ]; then
|
||||
setting_var="path"
|
||||
fi
|
||||
ynh_app_setting_set $app $setting_var ${!var}
|
||||
done
|
||||
}
|
||||
|
||||
# usage: ynh_save_persistent MODE RELATIVE_PATH
|
||||
ynh_save_persistent () {
|
||||
local TYPE=$1
|
||||
local DIR=/tmp/ynh-persistent/$app
|
||||
set +u
|
||||
i=${#YNH_PERSISTENT_DIR[@]}
|
||||
i=${i:-0}
|
||||
set -u
|
||||
[ "$i" -eq "0" ] && ynh_secure_remove $DIR && mkdir -p $DIR
|
||||
if [ -e $final_path/$2 ]; then
|
||||
mv $final_path/$2 $DIR/$i
|
||||
YNH_PERSISTENT_MODE[$i]=$1
|
||||
YNH_PERSISTENT_DIR[$i]=$2
|
||||
fi
|
||||
}
|
||||
|
||||
ynh_keep_if_no_upgrade () {
|
||||
for elt in $@;
|
||||
do
|
||||
ynh_save_persistent KEEP_IF_NO_UPGRADE $elt
|
||||
done
|
||||
}
|
||||
ynh_keep () {
|
||||
for elt in $@;
|
||||
do
|
||||
ynh_save_persistent KEEP $elt
|
||||
done
|
||||
}
|
||||
# usage: ynh_restore_persistent
|
||||
ynh_restore_persistent () {
|
||||
local DIR=/tmp/ynh-persistent/$app
|
||||
if [ -d $DIR ]; then
|
||||
i=0
|
||||
for PERSISTENT_DIR in "${YNH_PERSISTENT_DIR[@]}";
|
||||
do
|
||||
if [ "${YNH_PERSISTENT_MODE[$i]}" = "KEEP_IF_NO_UPGRADE" ]; then
|
||||
if [ ! -e $final_path/$PERSISTENT_DIR ]; then
|
||||
mv $DIR/$i $final_path/$PERSISTENT_DIR
|
||||
fi
|
||||
else
|
||||
if [ -e $final_path/$PERSISTENT_DIR ]; then
|
||||
ynh_secure_remove $final_path/$PERSISTENT_DIR
|
||||
fi
|
||||
mv $DIR/$i $final_path/$PERSISTENT_DIR
|
||||
fi
|
||||
((i+=1))
|
||||
done
|
||||
ynh_secure_remove $DIR
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||
|
|
Loading…
Add table
Reference in a new issue