mirror of
https://github.com/YunoHost-Apps/jirafeau_ynh.git
synced 2024-09-03 19:35:53 +02:00
commit
97b808a9ef
5 changed files with 66 additions and 4 deletions
|
@ -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.
|
||||
|
||||
**Shipped version:** 3.4.1
|
||||
**Shipped version:** 4.1.1
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/repository/3.4.1/archive.tar.gz
|
||||
SOURCE_SUM=7719dcac5080ebfb65500b64c24e358d
|
||||
SOURCE_URL=https://gitlab.com/mojo42/Jirafeau/repository/4.1.1/archive.tar.gz
|
||||
SOURCE_SUM=37f1754dfa3e8fc1ed81904a3dc33752
|
||||
SOURCE_SUM_PRG=md5sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -32,6 +32,7 @@ location __PATH__/ {
|
|||
deny all;
|
||||
}
|
||||
|
||||
|
||||
location ~ [^/]\.php(/|$) {
|
||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
|
|
|
@ -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": "3.4.1~ynh3",
|
||||
"version": "4.1.1~ynh1",
|
||||
"url": "https://gitlab.com/mojo42/Jirafeau",
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
|
|
|
@ -51,6 +51,67 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
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
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue