Skip to content

Commit e03b095

Browse files
committed
nc-previews: improvements
1 parent ccb6fc1 commit e03b095

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

bin/ncp/TOOLS/nc-previews.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@
1111

1212
configure()
1313
{
14-
sudo -u www-data php /var/www/nextcloud/occ preview:generate-all
14+
[[ "$CLEAN" == "yes" ]] && {
15+
local datadir
16+
datadir=$( ncc config:system:get datadirectory ) || {
17+
echo "data dir not found";
18+
return 1;
19+
}
20+
21+
rm -r "$datadir"/appdata_*/preview/* &>/dev/null
22+
mysql nextcloud <<<"delete from oc_filecache where path like \"appdata_%/preview/%\""
23+
ncc files:scan-app-data -n
24+
}
25+
26+
[[ "$INCREMENTAL" == "yes" ]] && { ncc preview:pre-generate -n -vvv; return $?; }
27+
28+
ncc preview:generate-all -n -v -p "$PATH1"
1529
}
1630
1731
install() { :; }

etc/ncp-config.d/nc-previews.cfg

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,26 @@
33
"name": "Nc-previews",
44
"title": "nc-previews",
55
"description": "Generate previews for the gallery",
6-
"info": "This will make browsing the gallery much more smooth.\nFor big collections, this can take a LONG time, depending on your hardware",
6+
"info": "This will make browsing the gallery much more smooth.\nFor big collections, this can take a LONG time, depending on your hardware\nOptionally, include a path in the form '/_user_/files/_path_' (incremental only)",
77
"infotitle": "",
8-
"params": []
8+
"params": [
9+
{
10+
"id": "CLEAN",
11+
"name": "Clean first",
12+
"value": "no",
13+
"type": "bool"
14+
},
15+
{
16+
"id": "INCREMENTAL",
17+
"name": "Incremental",
18+
"value": "yes",
19+
"type": "bool"
20+
},
21+
{
22+
"id": "PATH1",
23+
"name": "Path",
24+
"value": "",
25+
"suggest": "/ncp/files/Documents"
26+
}
27+
]
928
}

0 commit comments

Comments
 (0)