mirror of
https://github.com/YunoHost-Apps/dokuwiki_ynh.git
synced 2024-09-03 18:26:20 +02:00
[enh] Simplify by removing subprocess + add comment
This commit is contained in:
parent
fac3df2025
commit
1332c38656
1 changed files with 35 additions and 41 deletions
|
@ -230,49 +230,43 @@ then
|
||||||
# See https://www.dokuwiki.org/install:unused_files
|
# See https://www.dokuwiki.org/install:unused_files
|
||||||
if [ -f "$final_path/data/deleted.files" ]; then
|
if [ -f "$final_path/data/deleted.files" ]; then
|
||||||
|
|
||||||
# Use a "sub process" to start a new shell to run these commands
|
# Feed output of grep[...] line by line to 'ynh_secure_remove'
|
||||||
# Allow to use only one "cd" and to be more efficent
|
# 'ynh_secure_remove' can only work file by file. Cannot work with a list
|
||||||
(
|
# This is a (complicated) workaround this limitation
|
||||||
# Move to the dokuwiki installation folder so the "official" commands can be used without adaptation
|
while IFS= read -r line; do
|
||||||
cd $final_path
|
|
||||||
|
|
||||||
while IFS= read -r line; do
|
# Added this test to reduce the spam printed by helper to the user in the webadmin.
|
||||||
|
# Should be less 'scary' to them I think
|
||||||
|
#
|
||||||
|
# number of messages = number of lines *2 (673 lines while writing this)
|
||||||
|
### grep --extended-regexp --invert-match '^($|#)' data/deleted.files | wc -l
|
||||||
|
### 673
|
||||||
|
#
|
||||||
|
# Spam sample:
|
||||||
|
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
||||||
|
#Info : 'inc/parser/spamcheck.php' wasn't deleted because it doesn't exist.
|
||||||
|
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
||||||
|
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
||||||
|
#Info : 'lib/images/favicon.ico' wasn't deleted because it doesn't exist.
|
||||||
|
#Info : 'lib/images/thumbup.gif' wasn't deleted because it doesn't exist.
|
||||||
|
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
||||||
|
#Info : 'lib/images/toolbar/code.png' wasn't deleted because it doesn't exist.
|
||||||
|
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
||||||
|
#Info : 'lib/images/toolbar/empty.png' wasn't deleted because it doesn't exist.
|
||||||
|
if [ -f "$line" ]; then
|
||||||
|
ynh_secure_remove --file "$line"
|
||||||
|
fi
|
||||||
|
done < <(grep --null --extended-regexp --invert-match '^($|#)' "$final_path/data/deleted.files" | xargs --null --max-args=1 || true)
|
||||||
|
# ^ ^ First < is redirection, second is process substitution.
|
||||||
|
# Source: https://tldp.org/LDP/abs/html/process-sub.html
|
||||||
|
|
||||||
# Added this test to reduce the spam printed by helper to the user in the webadmin.
|
# Previous attemps if someone reads this one day
|
||||||
# Should be less 'scary' to them I think
|
###grep --extended-regexp --invert-match '^($|#)' data/deleted.files | xargs --max-args=1 rm --verbose --force --dir 2>&1 || true
|
||||||
#
|
###grep --extended-regexp --invert-match '^($|#)' data/deleted.files | xargs --max-args=1 ynh_secure_remove --file 2>&1
|
||||||
# number of messages = number of lines *2 (673 lines while writing this)
|
|
||||||
### grep --extended-regexp --invert-match '^($|#)' data/deleted.files | wc -l
|
|
||||||
### 673
|
|
||||||
#
|
|
||||||
# Spam sample:
|
|
||||||
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
|
||||||
#Info : 'inc/parser/spamcheck.php' wasn't deleted because it doesn't exist.
|
|
||||||
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
|
||||||
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
|
||||||
#Info : 'lib/images/favicon.ico' wasn't deleted because it doesn't exist.
|
|
||||||
#Info : 'lib/images/thumbup.gif' wasn't deleted because it doesn't exist.
|
|
||||||
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
|
||||||
#Info : 'lib/images/toolbar/code.png' wasn't deleted because it doesn't exist.
|
|
||||||
#Attention : /!\ Packager ! You provided more than one argument to ynh_secure_remove but it will be ignored... Use this helper with one argument at time.
|
|
||||||
#Info : 'lib/images/toolbar/empty.png' wasn't deleted because it doesn't exist.
|
|
||||||
if [ -f "$line" ]; then
|
|
||||||
ynh_secure_remove --file "$line"
|
|
||||||
fi
|
|
||||||
done < <(grep --null --extended-regexp --invert-match '^($|#)' "$final_path/data/deleted.files" | xargs --null --max-args=1 || true)
|
|
||||||
# ^ ^ First < is redirection, second is process substitution.
|
|
||||||
# Source: https://tldp.org/LDP/abs/html/process-sub.html
|
|
||||||
|
|
||||||
# Previous attemps if someone reads this one day
|
###grep --null --extended-regexp --invert-match '^($|#)' data/deleted.files > toto.list
|
||||||
###grep --extended-regexp --invert-match '^($|#)' data/deleted.files | xargs --max-args=1 rm --verbose --force --dir 2>&1 || true
|
###xargs --null --verbose --max-args=1 --arg-file=toto.list ynh_secure_remove 2>&1
|
||||||
###grep --extended-regexp --invert-match '^($|#)' data/deleted.files | xargs --max-args=1 ynh_secure_remove --file 2>&1
|
fi
|
||||||
|
|
||||||
###grep --null --extended-regexp --invert-match '^($|#)' data/deleted.files > toto.list
|
|
||||||
###xargs --null --verbose --max-args=1 --arg-file=toto.list ynh_secure_remove 2>&1
|
|
||||||
|
|
||||||
|
|
||||||
)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# TODO Taken from old "upgrade" script. Should check if it is needed and what it does
|
# TODO Taken from old "upgrade" script. Should check if it is needed and what it does
|
||||||
# Update all plugins
|
# Update all plugins
|
||||||
|
|
Loading…
Add table
Reference in a new issue