From d7bbe2516e2f39b4fa72276cc80a1f26daaebaa8 Mon Sep 17 00:00:00 2001 From: nachoparker Date: Wed, 13 Mar 2019 00:24:34 -0600 Subject: nc-scan: improvements --- bin/ncp/TOOLS/nc-scan.sh | 19 +++++++++++++++---- etc/ncp-config.d/nc-scan.cfg | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/bin/ncp/TOOLS/nc-scan.sh b/bin/ncp/TOOLS/nc-scan.sh index b8b40507..394bb53c 100644 --- a/bin/ncp/TOOLS/nc-scan.sh +++ b/bin/ncp/TOOLS/nc-scan.sh @@ -11,17 +11,28 @@ install() { - cat > /usr/local/bin/ncp-scan < /usr/local/bin/ncp-scan <<'EOF' #!/bin/bash -cd /var/www/nextcloud -sudo -u www-data php occ files:scan --all +ncc files:scan -n -v --all EOF chmod +x /usr/local/bin/ncp-scan } configure() { - /usr/local/bin/ncp-scan + [[ "$RECURSIVE" == no ]] && local recursive=--shallow + [[ "$NONEXTERNAL" == yes ]] && local non_external=--home-only + + [[ "$PATH1" != "" ]] && \ + ncc files:scan -n -v $recursive $non_external -p "$PATH1" + + [[ "$PATH2" != "" ]] && \ + ncc files:scan -n -v $recursive $non_external -p "$PATH2" + + [[ "$PATH3" != "" ]] && \ + ncc files:scan -n -v $recursive $non_external -p "$PATH3" + + [[ "${PATH1}${PATH2}${PATH3}" == "" ]] && ncc files:scan -n -v --all } # License diff --git a/etc/ncp-config.d/nc-scan.cfg b/etc/ncp-config.d/nc-scan.cfg index edc3f88e..3c1f23f3 100644 --- a/etc/ncp-config.d/nc-scan.cfg +++ b/etc/ncp-config.d/nc-scan.cfg @@ -3,7 +3,38 @@ "name": "Nc-scan", "title": "nc-scan", "description": "Scan NC for externally modified files", - "info": "", + "info": "Optionally we can specify up to 3 paths in the form '_user_/files/_path_'", "infotitle": "", - "params": [] + "params": [ + { + "id": "RECURSIVE", + "name": "Recursive", + "value": "yes", + "type": "bool" + }, + { + "id": "NONEXTERNAL", + "name": "Ignore external files", + "value": "no", + "type": "bool" + }, + { + "id": "PATH1", + "name": "Path", + "value": "", + "suggest": "/ncp/files/Documents" + }, + { + "id": "PATH2", + "name": "Path", + "value": "", + "suggest": "/family/files/Photos" + }, + { + "id": "PATH3", + "name": "Path", + "value": "", + "suggest": "/family/files/Videos" + } + ] } -- cgit v1.2.3