Skip to content

Commit

Permalink
nc-scan: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Mar 13, 2019
1 parent e03b095 commit d7bbe25
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
19 changes: 15 additions & 4 deletions bin/ncp/TOOLS/nc-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@

install()
{
cat > /usr/local/bin/ncp-scan <<EOF
cat > /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
Expand Down
35 changes: 33 additions & 2 deletions etc/ncp-config.d/nc-scan.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}

0 comments on commit d7bbe25

Please sign in to comment.