mirror of
https://github.com/YunoHost-Apps/jirafeau_ynh.git
synced 2024-09-03 19:35:53 +02:00
parent
0615fbcfa5
commit
79d5799dd7
12 changed files with 52 additions and 122 deletions
|
@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
Jirafeau offers the possibility to host and share your files with ease. Choose a file, Jirafeau will provide you with a link with many options. It is possible to protect your links with a password as well as to choose how long the file will be kept on the server. The file and the link will self-destruct after this time. Downloads of transmitted files can be limited to a certain date, and each file can self-destruct after the first download. Jirafeau allows you to configure maximum retention times and maximum size per file. Encryption is available as an option.
|
||||
|
||||
|
||||
**Shipped version:** 4.3.0~ynh3
|
||||
**Shipped version:** 4.4.0~ynh1
|
||||
|
||||
**Demo:** https://demo.yunohost.org/jirafeau/
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
Jirafeau offre la possibilité d'héberger et de partager vos fichiers, le tout en toute simplicité. Choisissez un fichier, Jirafeau vous fournira un lien avec beaucoup d'options. Il est possible de protéger vos liens avec mot de passe ainsi que de choisir la durée de rétention du fichier sur le serveur. Le fichier et le lien s'autodétruiront passé ce délai. Les téléchargements des fichiers transmis peuvent être limités à une certaine date, et chaque fichier peut s'autodétruire après le premier téléchargement. Jirafeau permet de configurer les temps maximum de rétention ainsi que la taille maximale par fichier. Le chiffrement est disponible en option.
|
||||
|
||||
|
||||
**Version incluse :** 4.3.0~ynh3
|
||||
**Version incluse :** 4.4.0~ynh1
|
||||
|
||||
**Démo :** https://demo.yunohost.org/jirafeau/
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
#4.3.0~ynh3
|
||||
upgrade=1 from_commit=0615fbcfa5b163812657b2f291026bf24b5e0667
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
change_url=1
|
||||
|
@ -20,7 +22,6 @@
|
|||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=
|
||||
name=
|
||||
manifest_arg=domain=DOMAIN&path=PATH&admin_user=USER&upload_password=supersecretpassword&is_public=1&
|
||||
; commit=0615fbcfa5b163812657b2f291026bf24b5e0667
|
||||
name=Merge pull request #92
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/-/archive/4.3.0/Jirafeau-4.3.0.tar.gz
|
||||
SOURCE_SUM=77bd4b69cb822ac8cac9df6890f17a673c978b10d8dd6fce46b60c763b859f74
|
||||
SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/-/archive/4.4.0/Jirafeau-4.4.0.tar.gz
|
||||
SOURCE_SUM=2afd605756e5d61d621092a1f796be63280d7394a9b61aedf9edbf7308c0cdba
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# https://gitlab.com/mojo42/Jirafeau/#how-can-i-automatize-the-cleaning-of-old-expired-files
|
||||
|
||||
12 3 * * * __APP__ php__PHPVERSION__ __FINALPATH__/admin.php clean_expired
|
||||
16 3 * * * __APP__ php__PHPVERSION__ __FINALPATH__/admin.php clean_async
|
||||
12 3 * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/admin.php clean_expired
|
||||
16 3 * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/admin.php clean_async
|
||||
|
|
|
@ -110,22 +110,22 @@ pm = dynamic
|
|||
; forget to tweak pm.* to fit your needs.
|
||||
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
|
||||
; Note: This value is mandatory.
|
||||
pm.max_children = 6
|
||||
pm.max_children = 5
|
||||
|
||||
; The number of child processes created on startup.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
|
||||
pm.start_servers = 3
|
||||
pm.start_servers = 2
|
||||
|
||||
; The desired minimum number of idle server processes.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
; Note: Mandatory when pm is set to 'dynamic'
|
||||
pm.min_spare_servers = 3
|
||||
pm.min_spare_servers = 1
|
||||
|
||||
; The desired maximum number of idle server processes.
|
||||
; Note: Used only when pm is set to 'dynamic'
|
||||
; Note: Mandatory when pm is set to 'dynamic'
|
||||
pm.max_spare_servers = 5
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
; The number of seconds after which an idle process will be killed.
|
||||
; Note: Used only when pm is set to 'ondemand'
|
||||
|
@ -419,8 +419,8 @@ chdir = __FINALPATH__
|
|||
;php_admin_value[memory_limit] = 32M
|
||||
|
||||
; Common values to change to increase file upload limit
|
||||
; php_admin_value[upload_max_filesize] = 50M
|
||||
; php_admin_value[post_max_size] = 50M
|
||||
php_admin_value[upload_max_filesize] = 10G
|
||||
php_admin_value[post_max_size] = 10G
|
||||
; php_admin_flag[mail.add_x_header] = Off
|
||||
|
||||
; Other common parameters
|
||||
|
@ -428,5 +428,3 @@ chdir = __FINALPATH__
|
|||
; php_admin_value[max_input_time] = 300
|
||||
; php_admin_value[memory_limit] = 256M
|
||||
; php_admin_flag[short_open_tag] = On
|
||||
php_admin_value[upload_max_filesize] = 10G
|
||||
php_admin_value[post_max_size] = 10G
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Upload a file in a simple way and give a unique link to it",
|
||||
"fr": "Hébergez simplement un fichier et partagez-le avec un lien unique"
|
||||
},
|
||||
"version": "4.3.0~ynh3",
|
||||
"version": "4.4.0~ynh1",
|
||||
"url": "https://gitlab.com/mojo42/Jirafeau",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
pkg_dependencies=""
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -25,6 +25,7 @@ path_url=$YNH_APP_ARG_PATH
|
|||
admin_user=$YNH_APP_ARG_ADMIN_USER
|
||||
upload_password=$YNH_APP_ARG_UPLOAD_PASSWORD
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -49,6 +50,13 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url
|
|||
ynh_app_setting_set --app=$app --key=admin --value=$admin_user
|
||||
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=2
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
|
|
@ -57,6 +57,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
|
|||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=3
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE CRON FILE
|
||||
#=================================================
|
||||
|
|
|
@ -24,7 +24,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
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)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
|
@ -77,6 +76,14 @@ chmod 750 "$datadir"
|
|||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=3
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -84,8 +91,6 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
|
|||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
|
|
108
scripts/upgrade
108
scripts/upgrade
|
@ -22,7 +22,7 @@ admin_user=$(ynh_app_setting_get --app=$app --key=admin)
|
|||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
upload_password=$(ynh_app_setting_get --app=$app --key=upload_password)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
phpversion=$YNH_PHP_VERSION
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
|
@ -62,65 +62,6 @@ if [ -z "$datadir" ]; then
|
|||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
fi
|
||||
|
||||
# Migrate files from 3.4.1 to 4.1.1
|
||||
current_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$app/manifest.json")"
|
||||
update_version="$(ynh_app_upstream_version)"
|
||||
# If the upgrade if from a version 3 or less to 4 or more. Migrate the files
|
||||
if [ ${current_version:0:1} -le 3 ] && [ ${update_version:0:1} -ge 4 ]
|
||||
then
|
||||
ynh_script_progression --message="Migrating files..." --weight=5
|
||||
|
||||
# Migrate files and links to the new directory structure
|
||||
for type in files links
|
||||
do
|
||||
while read file
|
||||
do
|
||||
# Ignore _count files
|
||||
if echo "$file" | grep --quiet "_count$"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Remove all directories before the file name
|
||||
full_file="$file"
|
||||
file=$(basename $file)
|
||||
|
||||
# Split the file name every 8 characters
|
||||
split=0
|
||||
full_path="$datadir/$type"
|
||||
while [ $split -le ${#file} ]
|
||||
do
|
||||
part_dir="${file:$split:8}"
|
||||
# Increment the point where with start reading of 8.
|
||||
split=$((split+8))
|
||||
full_path="$full_path/$part_dir"
|
||||
done
|
||||
|
||||
# Create the new crazy directory structure
|
||||
mkdir -p "$full_path"
|
||||
# And move the file to this place
|
||||
mv "$full_file" "$full_path/$file"
|
||||
if [ "$type" = "files" ]; then
|
||||
mv "${full_file}_count" "$full_path"
|
||||
fi
|
||||
done <<< "$(find "$datadir/$type" -type f)" # List all files, without directories
|
||||
done
|
||||
|
||||
# And clean the old directories
|
||||
for type in files links
|
||||
do
|
||||
while read file
|
||||
do
|
||||
# Remove all directories before the last one
|
||||
dirname="$(basename $file)"
|
||||
# Delete the directory if it's only one character long
|
||||
if [ ${#dirname} -eq 1 ]
|
||||
then
|
||||
ynh_secure_remove --file="$file"
|
||||
fi
|
||||
done <<< "$(find "$datadir/$type" -maxdepth 1 -mindepth 1 -type d)" # List all first level directories
|
||||
done
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -140,7 +81,10 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=2
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/lib/config.local.php"
|
||||
|
||||
# Remove the install.php
|
||||
ynh_secure_remove --file=$final_path/install.php
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -164,47 +108,11 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
|||
ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# SET THE UPLOAD PASSWORD
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=3
|
||||
|
||||
jirafeauconfigfile="$final_path/lib/config.local.php"
|
||||
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/lib/config.local.php"
|
||||
|
||||
cp "../conf/config.local.php" "$final_path/lib/config.local.php"
|
||||
|
||||
# Set and save upload password, allowing an empty one
|
||||
if [ -z "$upload_password" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__UPLOAD_PASSWORD__" --replace_string="" --target_file="$jirafeauconfigfile"
|
||||
ynh_app_setting_set --app=$app --key=upload_password --value=""
|
||||
else
|
||||
ynh_replace_special_string --match_string="__UPLOAD_PASSWORD__" --replace_string="'$upload_password'" --target_file="$jirafeauconfigfile"
|
||||
ynh_app_setting_set --app=$app --key=upload_password --value="$upload_password"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE JIRAFEAU
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading $app configuration..." --weight=2
|
||||
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$jirafeauconfigfile"
|
||||
if [ "$path_url" = "/" ]
|
||||
then
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="" --target_file="$jirafeauconfigfile"
|
||||
else
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$jirafeauconfigfile"
|
||||
fi
|
||||
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$jirafeauconfigfile"
|
||||
ynh_replace_string --match_string="__ADMIN_USER__" --replace_string="$admin_user" --target_file="$jirafeauconfigfile"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$jirafeauconfigfile"
|
||||
|
||||
# Remove the install.php
|
||||
ynh_secure_remove --file=$final_path/install.php
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# SET THE CRON FILE
|
||||
|
|
Loading…
Reference in a new issue