From d0cbbecff859f14fa60a1476b0950b3b5d0273be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Sol=C3=ADs?= Date: Mon, 10 Feb 2025 15:55:29 +0000 Subject: [PATCH] fix: Correct the query for dbcount to be the same as the runtime one --- friendica-remove-invalid-photos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/friendica-remove-invalid-photos.sh b/friendica-remove-invalid-photos.sh index b928e5c..5f596f7 100755 --- a/friendica-remove-invalid-photos.sh +++ b/friendica-remove-invalid-photos.sh @@ -38,9 +38,9 @@ if [[ "${intense_optimizations}" -gt 0 ]]; then #https:// = 8 characters | /avatar/ = 8 characters indexlength=$(("${#url}" + 16)) mariadb "${db}" -e "alter table contact add index if not exists photo_index (photo(${indexlength}))" - dbcount=$(mariadb "${db}" -B -N -q -e "select count(\`id\`) from contact where photo like 'https:\/\/${url}/avatar/%'") + dbcount=$(mariadb "${db}" -B -N -q -e "select count(\`id\`) from \`contact\` where (\`photo\` like 'https:\/\/${url}/avatar/%' or \`photo\` like '')") else - dbcount=$(mariadb "${db}" -B -N -q -e "select count(\`id\`) from contact where photo like 'https:\/\/${url}/avatar/%' and (id in (select cid from \`user-contact\`) or id in (select \`uid\` from \`user\`) or \`id\` in (select \`contact-id\` from \`group_member\`))") + dbcount=$(mariadb "${db}" -B -N -q -e "select count(\`id\`) from \`contact\` where (\`photo\` like 'https:\/\/${url}/avatar/%' or \`photo\` like '') and (\`id\` in (select \`cid\` from \`user-contact\`) or \`id\` in (select \`uid\` from \`user\`) or \`id\` in (select \`contact-id\` from \`group_member\`))") fi loop() {