1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jirafeau_ynh.git synced 2024-09-03 19:35:53 +02:00

Merge pull request #70 from YunoHost-Apps/testing

Testing
This commit is contained in:
Kayou 2020-04-15 00:41:46 +02:00 committed by GitHub
commit e2633217ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 110 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# Jirafeau for YunoHost # Jirafeau for YunoHost
[![Integration level](https://dash.yunohost.org/integration/jirafeau.svg)](https://dash.yunohost.org/appci/app/jirafeau) [![Integration level](https://dash.yunohost.org/integration/jirafeau.svg)](https://dash.yunohost.org/appci/app/jirafeau) ![](https://ci-apps.yunohost.org/ci/badges/jirafeau.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/jirafeau.maintain.svg)
[![Install Jirafeau with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jirafeau) [![Install Jirafeau with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=jirafeau)
> *This package allow you to install Jirafeau quickly and simply on a YunoHost server. > *This package allow you to install Jirafeau quickly and simply on a YunoHost server.
@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
Jirafeau is a web site permitting to upload a file in a simple way and give an unique link to it. Jirafeau is a web site permitting to upload a file in a simple way and give an unique link to it.
**Shipped version:** 3.4.1 **Shipped version:** 4.1.1
## Screenshots ## Screenshots

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/repository/3.4.1/archive.tar.gz SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/repository/4.1.1/archive.tar.gz
SOURCE_SUM=7719dcac5080ebfb65500b64c24e358d SOURCE_SUM=37f1754dfa3e8fc1ed81904a3dc33752
SOURCE_SUM_PRG=md5sum SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

4
conf/cron Normal file
View file

@ -0,0 +1,4 @@
# https://gitlab.com/mojo42/Jirafeau/#how-can-i-automatize-the-cleaning-of-old-expired-files
12 3 * * * __APP__ php7.0 __FINALPATH__/admin.php clean_expired
16 3 * * * __APP__ php7.0 __FINALPATH__/admin.php clean_async

View file

@ -32,6 +32,7 @@ location __PATH__/ {
deny all; deny all;
} }
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;

View file

@ -6,7 +6,7 @@
"en": "Upload a file in a simple way and give a unique link to it", "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" "fr": "Hébergez simplement un fichier et partagez-le avec un lien unique"
}, },
"version": "3.4.1~ynh3", "version": "4.1.1~ynh1",
"url": "https://gitlab.com/mojo42/Jirafeau", "url": "https://gitlab.com/mojo42/Jirafeau",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": { "maintainer": {

View file

@ -54,6 +54,13 @@ ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE CRON FILE
#=================================================
ynh_script_progression --message="Backing up the cron file..."
ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -130,6 +130,15 @@ ynh_store_file_checksum --file="$jirafeauconfigfile"
# Remove the install.php # Remove the install.php
ynh_secure_remove --file=$final_path/install.php ynh_secure_remove --file=$final_path/install.php
#=================================================
# SET THE CRON FILE
#=================================================
ynh_script_progression --message="Configuring the cron file..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file=/etc/cron.d/$app
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=/etc/cron.d/$app
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================

View file

@ -45,6 +45,13 @@ ynh_script_progression --message="Removing php-fpm configuration..." --weight=2
# Remove the dedicated php-fpm config # Remove the dedicated php-fpm config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_script_progression --message="Removing the cron file..."
ynh_secure_remove --file="/etc/cron.d/$app"
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================

View file

@ -65,6 +65,13 @@ ynh_system_user_create --username=$app
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# SPECIFIC RESTORE # SPECIFIC RESTORE
#================================================= #=================================================

View file

@ -51,6 +51,67 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi 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
var_root=/home/yunohost.app/$app
# 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="$var_root/$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 "$var_root/$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
rm -r "$file"
fi
done <<< "$(find "$var_root/$type" -maxdepth 1 -mindepth 1 -type d)" # List all first level directories
done
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -157,6 +218,15 @@ ynh_store_file_checksum --file="$jirafeauconfigfile"
# Remove the install.php # Remove the install.php
ynh_secure_remove --file=$final_path/install.php ynh_secure_remove --file=$final_path/install.php
#=================================================
# SET THE CRON FILE
#=================================================
ynh_script_progression --message="Configuring the cron file..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file=/etc/cron.d/$app
ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file=/etc/cron.d/$app
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================