LibrePortal/scripts/app/containers/nextcloud/nextcloud_rescan_files.sh
librelad 3ecf213cab refactor(de-sudo): docker calls via runFileOp/dockerCommandRun, drop sudo
Container-plane docker now routes through the mode-aware helpers instead of
sudo: simple calls (exec/ps/run/build/images/inspect/port/logs across ~15
app/check scripts) -> runFileOp docker (rootless socket as the install user;
rooted via the docker group). The cd && docker compose paths drop the sudo on
the rooted branch (the rootless branch already used dockerCommandRunInstallUser
-- byte-identical now, manager-ready later); gluetun, which had no rootless
branch, now uses dockerCommandRun so force-recreate works in both modes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-24 16:29:22 +01:00

22 lines
679 B
Bash

#!/bin/bash
# Re-index Nextcloud's file metadata — useful after files are added or removed
# on disk outside of Nextcloud (rsync, restore, manual copy).
appNextcloudRescanFiles() {
local args="$1"
local username
username="$(authToolArg "$args" username)"
local target=--all
[[ -n "$username" ]] && target="$username"
local out
out=$(runFileOp docker exec -u www-data nextcloud-service php occ files:scan $target 2>&1)
if echo "$out" | grep -qi "scanned\|files found"; then
isSuccessful "Nextcloud file rescan completed${username:+ for $username}."
return 0
fi
isError "Nextcloud file rescan failed: $out"; return 1
}