New step to remove generated previews from NC data directory

This commit is contained in:
2022-01-22 00:18:34 +01:00
parent 9507922968
commit b1acff2d70
2 changed files with 45 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
# Configuration file for nextcloud sequence # Configuration file for nextcloud sequence
NC_INSTALL_DIR="/var/www/nextcloud" NC_INSTALL_DIR="/var/www/nextcloud"
NC_DATA_DIR="${NC_INSTALL_DIR}/data"

View File

@@ -32,14 +32,15 @@ step_20() {
} }
ncInstaller="updater/updater.phar" ncInstaller="updater/updater.phar"
step_100_info() { echo "Delete IP from bruteforce table <NC DATABASE> <IPV4 ADDRESS>"; } step_100_info() { echoinfoArgs "<NC DATABASE> <IPV4 ADDRESS>"; echo "Delete IP from bruteforce table"; }
step_100_alias() { ALIAS="bruteforceRemoveIP"; }
step_100() { step_100() {
shift
local ncdb= local ncdb=
local ip= local ip=
local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$' local ipregex='^[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}\.[0-2]*[0-9]{1,2}$'
if [ -z $2 ] ; then if [ -z $1 ] ; then
echoerr " [E] No database provided" echoerr " [E] No database provided"
if [ -f "${WDIR}/mysql.sh" ] ; then if [ -f "${WDIR}/mysql.sh" ] ; then
echo " [I] Available mysql databases:" echo " [I] Available mysql databases:"
@@ -47,13 +48,13 @@ step_100() {
fi fi
return 1 return 1
else else
ncdb="$2" ncdb="$1"
fi fi
# Check if string looks like ipv4 address # Check if string looks like ipv4 address
if [[ "$3" =~ $ipregex ]] ; then if [[ "$2" =~ $ipregex ]] ; then
ip="$3" ip="$2"
else else
echoerr " [E] No valid IP:PORT detected: $3" echoerr " [E] No valid IP:PORT detected: $2"
return 1 return 1
fi fi
@@ -61,7 +62,7 @@ step_100() {
endReturn -o $? "Error deleting ip $ip" endReturn -o $? "Error deleting ip $ip"
} }
step_102_info() { echo "Reset and rescan the music library in the background"; } step_102_info() { echoinfoArgs "<USER>"; echo "Reset and rescan the music library in the background for one user"; }
step_102_alias() { ALIAS="audioreset"; } step_102_alias() { ALIAS="audioreset"; }
step_102() { step_102() {
shift shift
@@ -78,5 +79,39 @@ step_102() {
exep "sudo -u www-data php \"$NC_INSTALL_DIR/occ\" audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &" exep "sudo -u www-data php \"$NC_INSTALL_DIR/occ\" audioplayer:scan -vvvv $ncUser >> /var/log/ncAudioRescan.log &"
} }
VERSION_SEQREV=13 step_104_info() { echo "Reset picture preview folder"; }
step_104_alias() { ALIAS="resetpreview"; }
step_104() {
local lOcc="sudo -u www-data php \"$NC_INSTALL_DIR/occ\""
if [ -e "${NC_DATA_DIR}" ]; then
exe rm -rf "${NC_DATA_DIR}/appdata_"*"/preview/"*
echoseq " [I] Rescan app data folder"
exep "$lOcc files:scan-app-data &"
else
echoerr " [E] Nextcloud data direcotry $NC_DATA_DIR not found"
return 1
fi
}
step_200_info() { echo "Notes"; }
step_200_alias() { ALIAS="notes"; }
step_200() {
outColor green
cat<<NOTES_END
# Recommended preview settings
[$NC_INSTALL_DIR/config/config.php]
occ config:app:set previewgenerator squareSizes --value="32 256"
occ config:app:set previewgenerator widthSizes --value="256 384"
occ config:app:set previewgenerator heightSizes --value="256"
occ config:system:set preview_max_x --value 2048
occ config:system:set preview_max_y --value 2048
occ config:system:set jpeg_quality --value 60
occ config:app:set preview jpeg_quality --value="60"
NOTES_END
}
VERSION_SEQREV=14
. /usr/local/bin/sequencer.sh . /usr/local/bin/sequencer.sh