nextcloud: make mail sync idempotent
This commit is contained in:
parent
90b071566a
commit
edd2189f3c
@ -15,7 +15,14 @@ account_exists() {
|
||||
local email="${2}"
|
||||
|
||||
# Nextcloud Mail does not provide a list command; export is safe (does not print passwords).
|
||||
/usr/sbin/runuser -u www-data -- php occ mail:account:export "${user_id}" 2>/dev/null | grep -Fq -- "- E-Mail: ${email}"
|
||||
local export
|
||||
if ! export=$(/usr/sbin/runuser -u www-data -- php occ mail:account:export "${user_id}" 2>/dev/null); then
|
||||
echo "WARN: unable to export mail accounts for ${user_id}; skipping sync for safety" >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
# Output formatting varies by Nextcloud/Mail versions and locale; match by email address.
|
||||
grep -Fq -- "${email}" <<<"${export}"
|
||||
}
|
||||
|
||||
token=$(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user