chore: Apply shellcheck/shfmt suggestions

This commit is contained in:
Carlos Solís 2025-02-07 16:21:07 +00:00
parent e3962133f0
commit 59be4584d5
5 changed files with 32 additions and 42 deletions

View file

@ -8,6 +8,7 @@ folder=/var/www/friendica
folderavatar=/var/www/friendica/avatar
loop() {
#Parse each file in folder
folderescaped=${folder////\\/}
ky=$(echo "${y}" | sed -e "s/${folderescaped}/https:\/\/${url}/g" -e "s/-[0-9]*\..*\$//g")
f=$(sudo mariadb "${db}" -N -B -q -e "select photo from contact where photo like '${ky}%' limit 1")
if [[ $? -eq 0 && -z ${f} && -f ${y} ]]; then
@ -23,7 +24,7 @@ loop() {
date
#Go to the Friendica installation
cd "${folderavatar}" || exit
let "indexlength=37+${#url}"
#let "indexlength=37+${#url}"
((indexlength = 49 + ${#url}))
sudo mariadb "${db}" -e "alter table contact add index if not exists photo_index (photo(${indexlength}))"
n=0
@ -33,7 +34,7 @@ sudo find "${folderavatar}" -depth -mindepth 1 -maxdepth 1 -type d | while read
#If the directory still exists
if [[ -d "${x}" ]]; then
folderescaped=${folder////\\/}
kx=$(echo "${x}" | sed -e "s/${folderescaped}/https:\/\/${url}/g" -e "s/-[0-9]*\..*\$//g")
#kx=$(echo "${x}" | sed -e "s/${folderescaped}/https:\/\/${url}/g" -e "s/-[0-9]*\..*\$//g")
if [[ -d ${x} ]]; then
m=0
while read -r y; do